]> git.eshelyaron.com Git - emacs.git/commitdiff
Font lock \\`' command substitutions in docstrings
authorStefan Kangas <stefan@marxist.se>
Sat, 2 Jul 2022 03:35:15 +0000 (05:35 +0200)
committerStefan Kangas <stefan@marxist.se>
Sat, 2 Jul 2022 03:35:58 +0000 (05:35 +0200)
* lisp/emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-2):
Support \\`' command substitutions.

lisp/emacs-lisp/lisp-mode.el

index 6d5391d1e907bd5286079e741e69c9bc5cab6d82..3797217e1a0078609883b76b456785c7b869fa49 100644 (file)
@@ -476,8 +476,14 @@ This will generate compile-time constants from BINDINGS."
                    "[ \t']*\\(" lisp-mode-symbol-regexp "\\)?")
            (1 font-lock-keyword-face)
            (2 font-lock-constant-face nil t))
-         ;; Words inside \\[] tend to be for `substitute-command-keys'.
-         (,(concat "\\\\\\\\\\[\\(" lisp-mode-symbol-regexp "\\)\\]")
+         ;; Words inside \\[] or \\`' tend to be for `substitute-command-keys'.
+         (,(rx "\\\\[" (group (regexp lisp-mode-symbol-regexp)) "]")
+          (1 font-lock-constant-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).
          ("\\(\\\\\\)\\([^\"\\]\\)"