master 08f02cbae08: VC-Dir shows key binding hints
Sean Whitton <[email protected]>
| Newsgroups | gmane.emacs.diffs |
|---|---|
| Message-ID | <[email protected]> |
branch: master commit 08f02cbae08ccd945fc09d48c3ee02dce628bee8 Author: Sean Whitton <[email protected]> Commit: Sean Whitton <[email protected]> VC-Dir shows key binding hints * lisp/vc/vc-dir.el (vc-dir-key-binding-hint-label): New defcustom. (vc-dir-headers): Show key binding hints (bug#81190). * etc/NEWS: Document the change. --- etc/NEWS | 5 +++++ lisp/vc/vc-dir.el | 41 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/etc/NEWS b/etc/NEWS index 1308c3eda28..672e8b62971 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -109,6 +109,11 @@ This means it won't get in your way even if it's slow for your repository. As such, the 'vc-dir-show-outgoing-count' option is now obsolete. +--- +*** VC-Dir now shows key binding hints. +To hide these, you can customize the new user option +'vc-dir-show-key-binding-hints' to nil. + ** Outline mode *** New command 'outline-show-entry-and-parents'. diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index a7c6dc9eb01..151cb676838 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -64,6 +64,11 @@ See `run-hooks'." :group 'vc :version "28.1") +(defface vc-dir-key-binding-hint-label '((t :inherit font-lock-builtin-face)) + "Face for key binding labels in VC-Dir buffers." + :group 'vc + :version "32.1") + (defface vc-dir-header-urgent-value '((t :inherit font-lock-warning-face)) "Face for urgent header values in VC-Dir buffers." :group 'vc @@ -1494,6 +1499,12 @@ Each element is a pair (HEADER . FUN) where VC backend `dir-extra-headers' implementations may push additional elements to this list.") +(defcustom vc-dir-show-key-binding-hints t + "Whether to show key binding hints in VC-Dir buffers." + :type 'boolean + :group 'vc + :version "32.1") + (defun vc-dir-headers (backend dir) "Display the headers in the *VC-Dir* buffer. It calls the `dir-extra-headers' backend method to display backend @@ -1511,7 +1522,35 @@ specific headers." (concat (propertize (format "%-11s: " header) 'face 'vc-dir-header) "\n")) - vc-dir-async-header-values))) + vc-dir-async-header-values) + (and + vc-dir-show-key-binding-hints + (concat + "\n" + (substitute-command-keys + (concat + "\\<vc-dir-mode-map>" + (propertize "Act " 'font-lock-face 'vc-dir-key-binding-hint-label) + " " + "(\\[vc-revert]) Revert, " + "(\\[vc-dir-delete-file]) Delete, " + "(\\[vc-dir-ignore]) Ignore, " + "(\\[vc-next-action]/\\[vc-dir-root-next-action]) Commit/commit all, " + "(\\[vc-push]) Push" + "\n" + (propertize "Marks" 'font-lock-face 'vc-dir-key-binding-hint-label) + " " + "(\\[vc-dir-mark]) Mark, " + "(\\[vc-dir-unmark]) Unmark, " + "(\\[vc-dir-unmark-all-files]) Unmark same state/dir, " + "(\\[universal-argument] \\[vc-dir-unmark-all-files]) Unmark all" + "\n" + (propertize "View " 'font-lock-face 'vc-dir-key-binding-hint-label) + " " + "(\\[vc-diff]) Diff, " + "(\\[revert-buffer]) Refresh, " + "(\\[vc-dir-hide-up-to-date]) Hide up-to-date")) + "\n")))) (defun vc-dir--set-header (def-dir) (ewoc-set-hf vc-ewoc (vc-dir-headers vc-dir-backend def-dir) "")