diff options
author | Stefan Kangas <stefankangas@gmail.com> | 2022-11-15 08:45:02 +0100 |
---|---|---|
committer | Stefan Kangas <stefankangas@gmail.com> | 2022-11-15 08:45:02 +0100 |
commit | 0ac626f1d4eba84bd988a16991178ff25a07ece5 (patch) | |
tree | 5154bfcea5ac835cdcfb06e6ce1a27a518a99f55 | |
parent | 222c2970323e72c174f7b47201863ec9092e9595 (diff) | |
download | emacs-0ac626f1d4eba84bd988a16991178ff25a07ece5.tar.gz |
Use substitute-command-keys for buffer-menu help
* lisp/buff-menu.el (buffer-menu--display-help): New function.
(buffer-menu, buffer-menu-other-window): Fontify key bindings
using substitute-command-keys.
(Buffer-menu-delete): Advertise key binding as 'd'.
(Buffer-menu-this-window): Advertise key binding as 'f'.
-rw-r--r-- | lisp/buff-menu.el | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index abf152f058c..34221ee440d 100644 --- a/lisp/buff-menu.el +++ b/lisp/buff-menu.el @@ -1,7 +1,6 @@ ;;; buff-menu.el --- Interface for viewing and manipulating buffers -*- lexical-binding: t -*- -;; Copyright (C) 1985-1987, 1993-1995, 2000-2022 Free Software -;; Foundation, Inc. +;; Copyright (C) 1985-2022 Free Software Foundation, Inc. ;; Maintainer: emacs-devel@gnu.org ;; Keywords: convenience @@ -133,10 +132,12 @@ commands.") "M-s a C-s" #'Buffer-menu-isearch-buffers "M-s a C-M-s" #'Buffer-menu-isearch-buffers-regexp "M-s a C-o" #'Buffer-menu-multi-occur - "<mouse-2>" #'Buffer-menu-mouse-select "<follow-link>" 'mouse-face) +(put 'Buffer-menu-delete :advertised-binding "d") +(put 'Buffer-menu-this-window :advertised-binding "f") + (easy-menu-define Buffer-menu-mode-menu Buffer-menu-mode-map "Menu for `Buffer-menu-mode' buffers." '("Buffer-Menu" @@ -236,6 +237,26 @@ In Buffer Menu mode, the following commands are defined: (lambda (&optional _noconfirm) 'fast)) (add-hook 'tabulated-list-revert-hook 'list-buffers--refresh nil t)) +(defun buffer-menu--display-help () + (message "%s" + (substitute-command-keys + (concat + "Commands: " + "\\<Buffer-menu-mode-map>" + "\\[Buffer-menu-delete], " + "\\[Buffer-menu-save], " + "\\[Buffer-menu-execute], " + "\\[Buffer-menu-unmark]; " + "\\[Buffer-menu-this-window], " + "\\[Buffer-menu-other-window], " + "\\[Buffer-menu-1-window], " + "\\[Buffer-menu-2-window], " + "\\[Buffer-menu-mark], " + "\\[Buffer-menu-select]; " + "\\[Buffer-menu-not-modified], " + "\\[Buffer-menu-toggle-read-only]; " + "\\[quit-window] to quit; \\[describe-mode] for help")))) + (defun buffer-menu (&optional arg) "Switch to the Buffer Menu. By default, the Buffer Menu lists all buffers except those whose @@ -261,8 +282,7 @@ the `Buffer-menu-name-width', `Buffer-menu-size-width' and `Buffer-menu-mode-width' variables." (interactive "P") (switch-to-buffer (list-buffers-noselect arg)) - (message - "Commands: d, s, x, u; f, o, 1, 2, m, v; ~, %%; q to quit; ? for help.")) + (buffer-menu--display-help)) (defun buffer-menu-other-window (&optional arg) "Display the Buffer Menu in another window. @@ -273,8 +293,7 @@ with a space (which are for internal use). With prefix argument ARG, show only buffers that are visiting files." (interactive "P") (switch-to-buffer-other-window (list-buffers-noselect arg)) - (message - "Commands: d, s, x, u; f, o, 1, 2, m, v; ~, %%; q to quit; ? for help.")) + (buffer-menu--display-help)) ;;;###autoload (defun list-buffers (&optional arg) |