emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 15a5c5ce40: Make describe-prefix-bindings say when there are no m


From: Lars Ingebrigtsen
Subject: master 15a5c5ce40: Make describe-prefix-bindings say when there are no matches
Date: Fri, 10 Jun 2022 05:40:43 -0400 (EDT)

branch: master
commit 15a5c5ce40143edbdd436eeaa4cbb55f025f1771
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make describe-prefix-bindings say when there are no matches
    
    * lisp/help.el (describe-prefix-bindings): Say when there are no
    bindings under a prefix (bug#55875), for instance in `C-c C-h' in
    a buffer with no `C-c' commands.
---
 lisp/help.el | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/lisp/help.el b/lisp/help.el
index 4e0d807cb2..abdce46edf 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -392,16 +392,23 @@ If that doesn't give a function, return nil."
 The prefix described consists of all but the last event
 of the key sequence that ran this command."
   (interactive)
-  (let ((key (this-command-keys)))
-    (describe-bindings
-     (if (stringp key)
-        (substring key 0 (1- (length key)))
-       (let ((prefix (make-vector (1- (length key)) nil))
-            (i 0))
-        (while (< i (length prefix))
-          (aset prefix i (aref key i))
-          (setq i (1+ i)))
-        prefix)))))
+  (let* ((key (this-command-keys))
+         (prefix
+          (if (stringp key)
+             (substring key 0 (1- (length key)))
+            (let ((prefix (make-vector (1- (length key)) nil))
+                 (i 0))
+             (while (< i (length prefix))
+               (aset prefix i (aref key i))
+               (setq i (1+ i)))
+             prefix))))
+    (describe-bindings prefix)
+    (with-current-buffer (help-buffer)
+      (when (< (buffer-size) 10)
+        (let ((inhibit-read-only t))
+          (insert (format "No commands with a binding that start with %s."
+                          (help--key-description-fontified prefix))))))))
+
 ;; Make C-h after a prefix, when not specifically bound,
 ;; run describe-prefix-bindings.
 (setq prefix-help-command 'describe-prefix-bindings)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]