summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/lisp-mode.el
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2022-07-02 05:35:15 +0200
committerStefan Kangas <stefan@marxist.se>2022-07-02 05:35:58 +0200
commit3b66c23325909fef077831c5f289221583e75bd7 (patch)
tree44c82a732b8462537a652da835952dd449b0f82f /lisp/emacs-lisp/lisp-mode.el
parente3a3d6bf2324cf300d0d07bf655cf8f99ca030af (diff)
downloademacs-3b66c23325909fef077831c5f289221583e75bd7.tar.gz
Font lock \\`' command substitutions in docstrings
* lisp/emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-2): Support \\`' command substitutions.
Diffstat (limited to 'lisp/emacs-lisp/lisp-mode.el')
-rw-r--r--lisp/emacs-lisp/lisp-mode.el10
1 files changed, 8 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 6d5391d1e90..3797217e1a0 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -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).
("\\(\\\\\\)\\([^\"\\]\\)"