[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-diffs] [elpa] externals/auctex 1bc2630275 20/60: Don't change sy
From: |
Tassilo Horn |
Subject: |
[AUCTeX-diffs] [elpa] externals/auctex 1bc2630275 20/60: Don't change syntax of ^^A comments in doctex mode (bug#35140) |
Date: |
Fri, 8 Apr 2022 11:52:49 -0400 (EDT) |
branch: externals/auctex
commit 1bc2630275a28b3af8d9345f4d8fe6cdf4fe916a
Author: Ikumi Keita <ikumi@ikumi.que.jp>
Commit: Ikumi Keita <ikumi@ikumi.que.jp>
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.
---
font-latex.el | 63 +++++++++++++++++++++++++++--------------------------------
1 file changed, 29 insertions(+), 34 deletions(-)
diff --git a/font-latex.el b/font-latex.el
index fcfdc2312c..6249d6386d 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)
- [AUCTeX-diffs] [elpa] externals/auctex 259ffc34c4 12/60: Use DEFAULT argument of `TeX-read-string' in styles, (continued)
- [AUCTeX-diffs] [elpa] externals/auctex 259ffc34c4 12/60: Use DEFAULT argument of `TeX-read-string' in styles, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 0ce906cfc7 32/60: Improve indentation of conditionals, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex b7d45e19c6 22/60: Discard obsolete hook, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 2b11084455 30/60: ; * style/l3doc.el (LaTeX-env-l3doc-function): Delete unused var., Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 238dad67f9 04/60: Introduce DEFAULT argument in `TeX-arg-length', Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 7b0cbbb465 38/60: Document feature of []-induced indent, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 4b1c7015ae 45/60: Move contents of tex-buf.el into tex.el, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex e032df90e7 05/60: Fix simultaneity, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex a078fda16b 06/60: ; * doc/auctex.texi (Starting a Command): Delete obosolete comment., Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex b1a0d5df74 36/60: ; * style/algpseudocode.el: Fix position of TeX-dialect., Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 1bc2630275 20/60: Don't change syntax of ^^A comments in doctex mode (bug#35140),
Tassilo Horn <=
- [AUCTeX-diffs] [elpa] externals/auctex fa8842c626 26/60: Recognize macrocode*? environments in doctex-mode, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 45aff50ff3 48/60: Support \mathcolor in style/x?color.el, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 5d2829aed4 49/60: Remove old defadvices (patch by Stefan Monnier), Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 5cf46ff8e2 52/60: Improve parsing of re-definitions, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 03ed9004cd 60/60: Merge remote-tracking branch 'origin/master' into externals/auctex, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex c050335dd8 21/60: ; Fix typo, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 69b78fcc26 54/60: Don't change indentation when defining a conditional, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 323eb08ca6 46/60: Assign reasonable sentinel in AmS-TeX mode, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 2af3c1bcbd 33/60: Add new style/ifthen.el, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex e1c3e37e0c 56/60: ; Update copyright year, Tassilo Horn, 2022/04/08