[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 78c0f09 07/80: Fix fontification of simple macro
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 78c0f09 07/80: Fix fontification of simple macros |
Date: |
Wed, 16 Oct 2019 11:07:06 -0400 (EDT) |
branch: externals/auctex
commit 78c0f0961941178aad974e721e7964482ab9bbad
Author: Arash Esbati <address@hidden>
Commit: Arash Esbati <address@hidden>
Fix fontification of simple macros
* font-latex.el (font-latex-match-simple-command): Change second
part of regexp in order to be less greedy. This function now
fontifies only letters and characters defined in
`font-latex-match-simple-include-list' (bug#34712).
(font-latex-match-simple-include-list): New variable.
* style/expl3.el ("expl3"): Add "_" and ":" to
`font-latex-match-simple-include-list'.
---
font-latex.el | 25 +++++++++++++++++++++++--
style/expl3.el | 5 ++++-
2 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/font-latex.el b/font-latex.el
index bd504a8..8e8b4fc 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -1,6 +1,6 @@
;;; font-latex.el --- LaTeX fontification for Font Lock mode.
-;; Copyright (C) 1996-2017 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
;; Authors: Peter S. Galbraith <address@hidden>
;; Simon Marshall <address@hidden>
@@ -1714,6 +1714,14 @@ marks boundaries for searching for group ends."
"List of characters directly after \"\\\" excluded from fontification.
Each character is a string.")
+(defvar font-latex-match-simple-include-list '("@")
+ "List of characters allowed in a macro for fontification.
+Each character is a string. This variable is initialized to
+\"@\" since internal LaTeX commands are very often redefined in a
+.tex file and the fontification should work correctly in those
+cases.")
+(make-variable-buffer-local 'font-latex-match-simple-include-list)
+
(defun font-latex-match-simple-command (limit)
"Search for command like \\foo before LIMIT."
;; \s_ matches chars with symbol syntax, \sw chars with word syntax,
@@ -1726,7 +1734,20 @@ Each character is a string.")
;; like `\__module_foo:nnn'
(let* ((search (lambda ()
(TeX-re-search-forward-unescaped
- "\\\\\\(\\s_\\|\\sw\\|\\s.\\)\\(?:\\s_\\|\\sw\\)*" limit
t)))
+ (concat
+ ;; Chars directly after backslash
+ "\\\\\\(\\s_\\|\\sw\\|\\s.\\)"
+ ;; Start group of the following chars
+ "\\(?:["
+ ;; a-zA-Z are always allowed:
+ "a-zA-Z"
+ ;; Additional characters added by AUCTeX styles
+ (mapconcat #'identity
+ font-latex-match-simple-include-list
+ "")
+ ;; End group
+ "]\\)*")
+ limit t)))
(pos (funcall search)))
(while (and pos
(member (match-string 1)
diff --git a/style/expl3.el b/style/expl3.el
index c1bb029..4fdea24 100644
--- a/style/expl3.el
+++ b/style/expl3.el
@@ -1,6 +1,6 @@
;;; expl3.el --- AUCTeX style for `expl3.sty'
-;; Copyright (C) 2015, 2017, 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2017-2019 Free Software Foundation, Inc.
;; Author: Tassilo Horn <address@hidden>
;; Maintainer: address@hidden
@@ -48,6 +48,9 @@
(set-syntax-table LaTeX-expl3-syntax-table)
(when (and (fboundp 'font-latex-update-font-lock)
(eq TeX-install-font-lock 'font-latex-setup))
+ ;; Fontify _ and : as part of macros.
+ (add-to-list 'font-latex-match-simple-include-list "_" t)
+ (add-to-list 'font-latex-match-simple-include-list ":" t)
;; Tell font-lock about the update.
(font-latex-update-font-lock t)))
LaTeX-dialect)
- [elpa] externals/auctex updated (0c8d670 -> c5e47f8), Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 5b97c38 01/80: Add dependencies file auctex-pkg.el, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex c8177fd 05/80: * style/listings.el: Require tex.el., Tassilo Horn, 2019/10/16
- [elpa] externals/auctex c531148 04/80: ; Improve previous change in auctex.el.in, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 3543e45 06/80: New styles for beamerarticle & beamerswitch triggering beamer, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 78c0f09 07/80: Fix fontification of simple macros,
Tassilo Horn <=
- [elpa] externals/auctex 083964b 02/80: Delete auctex-pkg.el which is not needed for ELPA releases, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex b82ab0c 08/80: Support up to 12 command arguments., Tassilo Horn, 2019/10/16
- [elpa] externals/auctex cd39966 14/80: ; Fix typos, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 686a8ed 13/80: Elaborate LaTeX math insertion command, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 8a36595 12/80: Fix handling of function entries in `TeX-complete-list', Tassilo Horn, 2019/10/16
- [elpa] externals/auctex fcaef6b 11/80: Improve fontification of \href macro, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 23b3405 23/80: ; Fix typos, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 3b3c224 26/80: Remove compatibility code for xemacs, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 2a642a4 19/80: Add support for ChangeLog entries for LaTeX files, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex a8bbd1f 31/80: ; Fix document, Tassilo Horn, 2019/10/16