]> git.eshelyaron.com Git - emacs.git/commitdiff
Simplify lisp-el-font-lock-keywords-2 definition slightly
authorStefan Kangas <stefan@marxist.se>
Sun, 3 Jul 2022 21:05:50 +0000 (23:05 +0200)
committerStefan Kangas <stefan@marxist.se>
Sun, 3 Jul 2022 21:31:32 +0000 (23:31 +0200)
* lisp/emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-2):
Simplify slightly.

lisp/emacs-lisp/lisp-mode.el

index ac56d423391e0b0a0ff6908f4da7e00354ad5cbf..d61432b7ddf7cb200e7e8e55f800e30f1989f35b 100644 (file)
@@ -478,17 +478,15 @@ This will generate compile-time constants from BINDINGS."
            (2 font-lock-constant-face nil t))
          ;; Words inside \\[], \\<>, \\{} or \\`' tend to be for
          ;; `substitute-command-keys'.
-         (,(rx "\\\\[" (group (regexp lisp-mode-symbol-regexp)) "]")
+         (,(rx "\\\\" (or (seq "[" (group-n 1 (regexp lisp-mode-symbol-regexp)) "]")
+                          (seq "`" (group-n 1 (+ (regexp lisp-mode-symbol-regexp)
+                                                 ;; allow multiple words, e.g. "C-x a"
+                                                 (? " ")))
+                           "'")))
           (1 font-lock-constant-face prepend))
          (,(rx "\\\\" (or (seq "<" (group-n 1 (regexp lisp-mode-symbol-regexp)) ">")
                           (seq "{" (group-n 1 (regexp lisp-mode-symbol-regexp)) "}")))
           (1 font-lock-variable-name-face prepend))
-         (,(rx "\\\\`" (group
-                        (+ (regexp lisp-mode-symbol-regexp)
-                           ;; allow multiple words, e.g. "C-x a"
-                           (? " ")))
-               "'")
-          (1 font-lock-constant-face prepend))
          ;; Ineffective backslashes (typically in need of doubling).
          ("\\(\\\\\\)\\([^\"\\]\\)"
           (1 (elisp--font-lock-backslash) prepend))
@@ -496,7 +494,7 @@ This will generate compile-time constants from BINDINGS."
          (,(concat "[`‘']\\(" lisp-mode-symbol-regexp "\\)['’]")
           (1 font-lock-constant-face prepend))
          ;; \\= tends to be an escape in doc strings.
-         ("\\\\\\\\="
+         (,(rx "\\\\=")
           (0 font-lock-builtin-face prepend))
          ;; Constant values.
          (,(concat "\\_<:" lisp-mode-symbol-regexp "\\_>")