branch: scratch/auctex-lexbind
commit 7c2f403f5c39a314bc0b2d9e1e7c1507f55983d1
Author: Stefan Monnier <[email protected]>
Commit: Stefan Monnier <[email protected]>
* font-latex.el (font-latex-make-built-in-keywords): Reorder defs
Move definition of `font-latex-match-*-make` after the `defvar`s of
the vars it uses.
---
font-latex.el | 67 +++++++++++++++++++++++++++++++----------------------------
1 file changed, 35 insertions(+), 32 deletions(-)
diff --git a/font-latex.el b/font-latex.el
index 494fb30..e4a313b 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-2020 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
;; Authors: Peter S. Galbraith <[email protected]>
;; Simon Marshall <[email protected]>
@@ -622,37 +622,6 @@ Generated by `font-latex-make-built-in-keywords'.")))
(make-variable-buffer-local
(intern (concat prefix name "-keywords-local")))
- ;; defun font-latex-match-*-make
- ;; Note: The functions are byte-compiled at the end of font-latex.el.
- (eval `(defun ,(intern (concat prefix name "-make")) ()
- ,(concat "Make or remake the variable `" prefix name "'.
-
-Generated by `font-latex-make-built-in-keywords'.")
- (let ((keywords
- (append
- (unless (member ,name
- font-latex-deactivated-keyword-classes)
- ,(intern (concat prefix name "-keywords-local")))
- ,(intern (concat prefix name "-keywords"))))
- multi-char-macros single-char-macros)
- (dolist (elt keywords)
- (let ((keyword (if (listp elt) (car elt) elt)))
- (if (string-match "^[A-Za-z]" keyword)
- (push keyword multi-char-macros)
- (push keyword single-char-macros))))
- (when (or multi-char-macros single-char-macros)
- (setq ,(intern (concat prefix name))
- (concat
- "\\\\\\("
- (when multi-char-macros
- (concat
- "\\(?:" (regexp-opt multi-char-macros) "\\)\\>"))
- (when single-char-macros
- (concat
- (when multi-char-macros "\\|")
- "\\(?:" (regexp-opt single-char-macros) "\\)"))
- "\\)"))))))
-
;; defcustom font-latex-match-*-keywords
(eval `(defcustom ,(intern (concat prefix name "-keywords")) nil
,(concat "List of keywords "
@@ -688,6 +657,37 @@ Generated by `font-latex-make-built-in-keywords'.")
Generated by `font-latex-make-built-in-keywords'")))
(make-variable-buffer-local (intern (concat prefix name)))
+ ;; defun font-latex-match-*-make
+ ;; Note: The functions are byte-compiled at the end of font-latex.el.
+ (eval `(defun ,(intern (concat prefix name "-make")) ()
+ ,(concat "Make or remake the variable `" prefix name "'.
+
+Generated by `font-latex-make-built-in-keywords'.")
+ (let ((keywords
+ (append
+ (unless (member ,name
+ font-latex-deactivated-keyword-classes)
+ ,(intern (concat prefix name "-keywords-local")))
+ ,(intern (concat prefix name "-keywords"))))
+ multi-char-macros single-char-macros)
+ (dolist (elt keywords)
+ (let ((keyword (if (listp elt) (car elt) elt)))
+ (if (string-match "^[A-Za-z]" keyword)
+ (push keyword multi-char-macros)
+ (push keyword single-char-macros))))
+ (when (or multi-char-macros single-char-macros)
+ (setq ,(intern (concat prefix name))
+ (concat
+ "\\\\\\("
+ (when multi-char-macros
+ (concat
+ "\\(?:" (regexp-opt multi-char-macros) "\\)\\>"))
+ (when single-char-macros
+ (concat
+ (when multi-char-macros "\\|")
+ "\\(?:" (regexp-opt single-char-macros) "\\)"))
+ "\\)"))))))
+
;; defun font-latex-match-*
(font-latex-make-match-defun prefix name face type)
@@ -2246,6 +2246,9 @@ set to french, and >>german<< (and 8-bit) are used if set
to german."
;; 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))