From b000bd47a6efbd12cab6e6a1b19a59014931abd8 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sun, 3 Jul 2022 20:59:00 +0200 Subject: [PATCH] Font lock \\<> and \\{} command substitutions in docstrings * lisp/emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-2): Support \\<> and \\{} command substitutions. --- lisp/emacs-lisp/lisp-mode.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 3797217e1a0..ac56d423391 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -476,9 +476,13 @@ 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 \\[] or \\`' tend to be for `substitute-command-keys'. + ;; Words inside \\[], \\<>, \\{} or \\`' tend to be for + ;; `substitute-command-keys'. (,(rx "\\\\[" (group (regexp lisp-mode-symbol-regexp)) "]") (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" -- 2.39.2