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. 1bc2630275a28b3af8d93


From: Ikumi Keita
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 1bc2630275a28b3af8d9345f4d8fe6cdf4fe916a
Date: Sat, 5 Mar 2022 02:56:07 -0500 (EST)

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  1bc2630275a28b3af8d9345f4d8fe6cdf4fe916a (commit)
      from  3e95554c2710ab962521eb452f7ccd7ceafe0512 (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 1bc2630275a28b3af8d9345f4d8fe6cdf4fe916a
Author: Ikumi Keita <ikumi@ikumi.que.jp>
Date:   Wed Jul 7 22:56:39 2021 +0900

    Don't change syntax of ^^A comments in doctex mode (bug#35140)
    
    * font-latex.el (font-latex-doctex-match-^^A): New function to
    override fontification on ^^A and ^^X comments with ordinary comment
    face.
    (font-latex-doctex-keywords): Add an entry to use new function.
    (font-latex-doctex-^^A): Remove.
    (font-latex-set-syntactic-keywords): Don't add entry using removed
    function.
    (font-latex--make-syntax-propertize-function): Don't use
    `font-latex-doctex-syntactic-keywords'.
    (font-latex-setup): Use forward quote instead of back quote.
    (): Update copyright year.

diff --git a/font-latex.el b/font-latex.el
index fcfdc231..6249d638 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -1,6 +1,6 @@
 ;;; font-latex.el --- LaTeX fontification for Font Lock mode.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1996-2021  Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022  Free Software Foundation, Inc.
 
 ;; Authors:    Peter S. Galbraith <psg@debian.org>
 ;;             Simon Marshall <Simon.Marshall@esrin.esa.it>
@@ -1091,11 +1091,11 @@ have changed."
          (1 "|") (2 "|")))))
   (when font-latex-syntactic-keywords-extra
     (nconc font-latex-syntactic-keywords font-latex-syntactic-keywords-extra))
-  ;; Cater for docTeX mode.
-  (setq font-latex-doctex-syntactic-keywords
-        (append font-latex-syntactic-keywords
-                ;; For docTeX comment-in-doc.
-                '(("\\(\\^\\)\\^A" (1 (font-latex-doctex-^^A))))))
+  ;; ;; Cater for docTeX mode.
+  ;; (setq font-latex-doctex-syntactic-keywords
+  ;;       (append font-latex-syntactic-keywords
+  ;;               ;; For docTeX comment-in-doc.
+  ;;               '(("\\(\\^\\)\\^A" (1 (font-latex-doctex-^^A))))))
   ;; Finally, compute our `syntax-propertize-function' anew.
   (setq-local syntax-propertize-function
               (font-latex--make-syntax-propertize-function)))
@@ -1263,9 +1263,9 @@ triggers Font Lock to recognize the change."
 
 (defun font-latex--make-syntax-propertize-function ()
   "Return a `syntax-propertize-function' for (La|Doc)TeX documents."
-  (let ((kws (if (derived-mode-p 'doctex-mode)
-                 font-latex-doctex-syntactic-keywords
-               font-latex-syntactic-keywords)))
+  (let ((kws ;; (if (derived-mode-p 'doctex-mode)
+             ;;     font-latex-doctex-syntactic-keywords
+               font-latex-syntactic-keywords)) ;; )
     (syntax-propertize-via-font-lock kws)))
 
 ;;;###autoload
@@ -1286,7 +1286,7 @@ triggers Font Lock to recognize the change."
          `((font-latex-keywords font-latex-keywords-1 font-latex-keywords-2)
            nil nil ,font-latex-syntax-alist nil))
         (variables
-         `((font-lock-mark-block-function . mark-paragraph)
+         '((font-lock-mark-block-function . mark-paragraph)
            (font-lock-fontify-region-function
             . font-latex-fontify-region)
            (font-lock-unfontify-region-function
@@ -2250,32 +2250,27 @@ set to french, and >>german<< (and 8-bit) are used if 
set to german."
   :group 'font-latex-highlighting-faces)
 
 (defvar font-latex-doctex-keywords
-  (append font-latex-keywords-2
+  (append '((font-latex-doctex-match-^^A 0 font-lock-comment-face t))
+          font-latex-keywords-2
           '(("^%<[^>]*>" (0 font-latex-doctex-preprocessor-face t)))))
 
-;; Copy and adaptation of `doctex-font-lock-^^A' in `tex-mode.el' of
-;; CVS Emacs (March 2004)
-(defun font-latex-doctex-^^A ()
-  (if (eq (char-after (line-beginning-position)) ?\%)
-      (progn
-        (put-text-property
-         (1- (match-beginning 1)) (match-beginning 1) 'syntax-table
-         (if (= (1+ (line-beginning-position)) (match-beginning 1))
-             ;; The `%' is a single-char comment, which Emacs
-             ;; syntax-table can't deal with.  We could turn it
-             ;; into a non-comment, or use `\n%' or `%^' as the comment.
-             ;; Instead, we include it in the ^^A comment.
-             (eval-when-compile (string-to-syntax "< b"))
-           ;; FIXME: Those `eval-when-compile' shouldn't be needed any
-           ;; more since the byte-compiler will precompute those calls
-           ;; anyway (because `string-to-syntax'  is marked as pure).
-           (eval-when-compile (string-to-syntax ">"))))
-        (let ((end (line-end-position)))
-          (if (< end (point-max))
-              (put-text-property end (1+ end) 'syntax-table
-                                 (eval-when-compile
-                                   (string-to-syntax "> b")))))
-        (eval-when-compile (string-to-syntax "< b")))))
+(defun font-latex-doctex-match-^^A (limit)
+  "In docTeX mode, match comment started by ^^A and ^^X before LIMIT."
+  (catch 'found
+    (while (TeX-re-search-forward-unescaped "\\^\\^[AX]" limit t)
+      (when (eq (char-after (line-beginning-position)) ?\%)
+        (forward-line 1)
+        ;; Adjust `font-latex--updated-region-end' if necessary.
+        (let ((p (point)))
+          (if (< font-latex--updated-region-end limit)
+              (setq font-latex--updated-region-end limit))
+          (when (< font-latex--updated-region-end p)
+            (font-lock-unfontify-region
+             font-latex--updated-region-end p)
+            (setq font-latex--updated-region-end p))
+          ;; We assume that the above adjustment preserves match data.
+          (set-match-data (list (match-beginning 0) p)))
+        (throw 'found t)))))
 
 ;; Copy and adaptation of `doctex-font-lock-syntactic-face-function'
 ;; in `tex-mode.el' of CVS Emacs (March 2004)

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

Summary of changes:
 font-latex.el | 63 +++++++++++++++++++++++++++--------------------------------
 1 file changed, 29 insertions(+), 34 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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