auctex-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-diffs] GNU AUCTeX branch, master, updated. 9cf9f7cf9ff7fda2d6979


From: Tassilo Horn
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 9cf9f7cf9ff7fda2d697998fbb44e48f756659a3
Date: Tue, 25 Apr 2017 12:03:03 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU AUCTeX".

The branch, master has been updated
       via  9cf9f7cf9ff7fda2d697998fbb44e48f756659a3 (commit)
      from  581002f508fc49bd7c290d4fd3c4dec543d6ab9c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9cf9f7cf9ff7fda2d697998fbb44e48f756659a3
Author: Tassilo Horn <address@hidden>
Date:   Tue Apr 25 18:02:12 2017 +0200

    Correctly exclude hypenation and thin spaces from command matches
    
    * font-latex.el (font-latex-match-simple-command): Skip matches starting 
with
    \- or \,.

diff --git a/font-latex.el b/font-latex.el
index 4b687af..746193b 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -1781,11 +1781,17 @@ marks boundaries for searching for group ends."
 
 (defun font-latex-match-simple-command (limit)
   "Search for command like \\foo before LIMIT."
-  ;; The \\\\[^ ,-] makes sure we don't highlight hyphenation as
-  ;; commands (foo\-bar), nor thin spaces (foo\,bar) nor control
-  ;; spaces (foo\ bar).  \s_ matches chars with symbol syntax, \sw
-  ;; chars with word syntax.
-  (TeX-re-search-forward-unescaped "\\\\[^ ,-]\\(?:\\s_\\|\\sw\\)+" limit t))
+  ;; \s_ matches chars with symbol syntax, \sw chars with word syntax.  We must
+  ;; exclude matches where the first character after the \ is a , (thin space:
+  ;; foo\,bar) or a - (hyphenation: foo\-bar).
+  (let* ((search (lambda ()
+                  (TeX-re-search-forward-unescaped
+                   "\\\\\\(\\s_\\|\\sw\\)\\(?:\\s_\\|\\sw\\)*" limit t)))
+        (pos (funcall search)))
+    (while (and pos
+               (member (match-string 1) '("-" ",")))
+      (setq pos (funcall search)))
+    pos))
 
 (defun font-latex-match-math-env (limit)
   "Match math pattern up to LIMIT.

-----------------------------------------------------------------------

Summary of changes:
 font-latex.el | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

[Prev in Thread] Current Thread [Next in Thread]