From bda6e9a226f42d74176cba640dda7dfef25b764b Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sun, 3 Jul 2022 21:00:16 +0200 Subject: [PATCH] Use command substitutions instead of literal keys in some places * lisp/emulation/viper-macs.el (ex-map, viper-set-register-macro): * lisp/minibuffer.el (minibuffer-beginning-of-buffer-movement): * lisp/speedbar.el (speedbar-frame-mode): * lisp/subr.el (kbd): * lisp/textmodes/page-ext.el (pages-directory) (pages-directory-for-addresses): * lisp/textmodes/reftex-toc.el: Use command substitutions instead of literal keys. --- lisp/emulation/viper-macs.el | 8 +++++--- lisp/minibuffer.el | 3 ++- lisp/speedbar.el | 3 ++- lisp/subr.el | 2 +- lisp/textmodes/page-ext.el | 15 +++++++++------ lisp/textmodes/reftex-toc.el | 4 +++- 6 files changed, 22 insertions(+), 13 deletions(-) diff --git a/lisp/emulation/viper-macs.el b/lisp/emulation/viper-macs.el index c4eb183ce44..06130afa7da 100644 --- a/lisp/emulation/viper-macs.el +++ b/lisp/emulation/viper-macs.el @@ -105,7 +105,8 @@ a key is a symbol, e.g., `a', `\\1', `f2', etc., or a list, e.g., #'viper-end-mapping-kbd-macro) (define-key viper-emacs-intercept-map "\C-x)" #'viper-end-mapping-kbd-macro) - (message "Mapping %S in %s state. Type macro definition followed by `C-x )'" + (message (substitute-command-keys "Mapping %S in %s state. \ +Type macro definition followed by \\[kmacro-end-macro]") (viper-display-macro macro-name) (if ins "Insert" "Vi"))) )) @@ -886,8 +887,9 @@ mistakes in macro names to be passed to this function is to use (if (get-register reg) (if (y-or-n-p "Register contains data. Overwrite? ") () - (error - "Macro not saved in register. Can still be invoked via `C-x e'"))) + (error + (substitute-command-keys + "Macro not saved in register. Can still be invoked via \\[kmacro-end-and-call-macro]")))) (set-register reg last-kbd-macro)) (defun viper-register-macro (count) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 8a7da41a3b1..e029dfe4147 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -3091,7 +3091,8 @@ such as making the current buffer visit no file in the case of :type 'boolean) (defcustom minibuffer-beginning-of-buffer-movement nil - "Control how the `M-<' command in the minibuffer behaves. + "Control how the \\\\[minibuffer-beginning-of-buffer] \ +command in the minibuffer behaves. If non-nil, the command will go to the end of the prompt (if point is after the end of the prompt). If nil, it will behave like the `beginning-of-buffer' command." diff --git a/lisp/speedbar.el b/lisp/speedbar.el index b12cf3d9c2d..da85d548637 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el @@ -934,7 +934,8 @@ supported at a time. ;; reset the selection variable (setq speedbar-last-selected-file nil) (unless (display-graphic-p) - (message "Use `M-x speedbar-get-focus' to see the speedbar window"))) + (message (substitute-command-keys + "Use \\[speedbar-get-focus] to see the speedbar window")))) (defun speedbar-frame-reposition-smartly () "Reposition the speedbar frame to be next to the attached frame." diff --git a/lisp/subr.el b/lisp/subr.el index 4e4eac32d9d..2f9d37ffd6e 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -964,7 +964,7 @@ side-effects, and the argument LIST is not modified." (defun kbd (keys) "Convert KEYS to the internal Emacs key representation. KEYS should be a string in the format returned by commands such -as `C-h k' (`describe-key'). +as \\[describe-key] (`describe-key'). This is the same format used for saving keyboard macros (see `edmacro-mode'). diff --git a/lisp/textmodes/page-ext.el b/lisp/textmodes/page-ext.el index 24149f9afb8..6b71f26e4f2 100644 --- a/lisp/textmodes/page-ext.el +++ b/lisp/textmodes/page-ext.el @@ -515,13 +515,12 @@ resets the page-delimiter to the original value." (defvar pages-buffer-original-position) (defvar pages-buffer-original-page) -(defun pages-directory - (pages-list-all-headers-p count-lines-p &optional regexp) +(defun pages-directory (pages-list-all-headers-p count-lines-p &optional regexp) "Display a directory of the page headers in a temporary buffer. A header is the first non-blank line after the `page-delimiter'. -\\[pages-directory-mode] +\\ You may move point to one of the lines in the temporary buffer, -then use \\ to go to the same line in the pages buffer. +then use \\[pages-directory-goto] to go to the same line in the pages buffer. In interactive use: @@ -587,7 +586,9 @@ directory for only the accessible portion of the buffer." (pages-directory-mode) (setq buffer-read-only nil) (insert - "==== Pages Directory: use `C-c C-c' to go to page under cursor. ====" ?\n) + (substitute-command-keys + "==== Pages Directory: use \\\ +\\[pages-directory-goto] to go to page under cursor. ====") "\n") (setq pages-buffer pages-target-buffer) (setq pages-pos-list nil)) @@ -772,7 +773,9 @@ directory." (goto-char (point-min)) (delete-region (point) (line-end-position)) (insert - "=== Address List Directory: use `C-c C-c' to go to page under cursor. ===") + (substitute-command-keys + "=== Address List Directory: use \\\ +\\[pages-directory-goto] to go to page under cursor. ===")) (set-buffer-modified-p nil) )) (error "No addresses file found!"))) diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el index 9fdb104452b..89c734a0d76 100644 --- a/lisp/textmodes/reftex-toc.el +++ b/lisp/textmodes/reftex-toc.el @@ -394,7 +394,9 @@ SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help (frame-parameter frame 'name)) "RefTeX TOC Frame"))) (if (and res error) - (error "This frame is view-only. Use `C-c =' to create TOC window for commands")) + (error (substitute-command-keys + "This frame is view-only. Use \\[reftex-toc] \ +to create TOC window for commands"))) res)) (defun reftex-toc-show-help () -- 2.39.2