From c6abc78b5825b13febeee662433dbd7bb53d98e1 Mon Sep 17 00:00:00 2001 From: justbur Date: Wed, 18 Nov 2015 22:00:14 -0500 Subject: [PATCH] Provide alternate prefix-title for echo area --- which-key.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/which-key.el b/which-key.el index 490ed7db277..aaef402b459 100644 --- a/which-key.el +++ b/which-key.el @@ -1123,14 +1123,17 @@ An empty stiring is returned if no title exists." (let* ((alist which-key-prefix-title-alist) (res (assoc key-lst alist)) (mode-alist (assq major-mode alist)) - (mode-res (when mode-alist (assoc key-lst mode-alist)))) + (mode-res (when mode-alist (assoc key-lst mode-alist))) + (alternate (when (symbolp (key-binding (apply #'vector key-lst))) + (symbol-name (key-binding (apply #'vector key-lst)))))) (cond (mode-res (cdr mode-res)) (res (cdr res)) + ((and (eq which-key-show-prefix 'echo) alternate) + alternate) ((and (member which-key-show-prefix '(bottom top)) (eq which-key-side-window-location 'bottom) echo-keystrokes) - (if (symbolp (key-binding (apply #'vector key-lst))) - (symbol-name (key-binding (apply #'vector key-lst))) + (if alternate alternate (concat "Following " (key-description key-lst)))) (t ""))) "Top-level bindings"))