]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't output prefix keys in `C-h b', and output more data on objects
authorLars Ingebrigtsen <larsi@gnus.org>
Mon, 1 Nov 2021 15:06:16 +0000 (16:06 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 1 Nov 2021 15:06:21 +0000 (16:06 +0100)
* lisp/help.el (help--describe-command): Output
[closure/lambda/byte-code] for those types of objects.
(describe-map): Don't output prefix keys.

etc/NEWS
lisp/help.el
test/lisp/help-tests.el

index 0aff35627af51cc0666fc359e49bc5c3fd14b1b5..114441f1b6aba0da7b633bc39bf766ce37237295 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -307,6 +307,12 @@ Emacs buffers, like indentation and the like.  The new ert function
 \f
 * Incompatible Lisp Changes in Emacs 29.1
 
+** Keymap descriptions have changed.
+'help--describe-command', 'C-h b' and associated functions that output
+keymap descriptions have changed.  In particular, prefix commands are
+not output at all, and instead of "??" for closures/functions,
+"[closure]"/"[lambda]" is output.
+
 ---
 ** 'downcase' details have changed slightly.
 In certain locales, changing the case of an ASCII-range character may
index acd8a123ab558c4d89e9439889eda8245478daed..293dd445459b3fb09efa05b57840c0be5c1727ac 100644 (file)
@@ -1357,7 +1357,13 @@ Return nil if the key sequence is too long."
            (insert "Keyboard Macro\n"))
           ((keymapp definition)
            (insert "Prefix Command\n"))
-          (t (insert "??\n")))))
+          ((byte-code-function-p definition)
+           (insert "[byte-code]\n"))
+          ((and (consp definition)
+                (memq (car definition) '(closure lambda)))
+           (insert (format "[%s]\n" (car definition))))
+          (t
+           (insert "??\n")))))
 
 (defun help--describe-translation (definition)
   ;; Converted from describe_translation in keymap.c.
@@ -1456,10 +1462,6 @@ TRANSL, PARTIAL, SHADOW, NOMENU, MENTION-SHADOW are as in
                (definition (cadr elem))
                (shadowed (caddr elem))
                (end start))
-          (when first
-            (setq help--previous-description-column 0)
-            (insert "\n")
-            (setq first nil))
           ;; Find consecutive chars that are identically defined.
           (when (fixnump start)
             (while (and (cdr vect)
@@ -1474,24 +1476,32 @@ TRANSL, PARTIAL, SHADOW, NOMENU, MENTION-SHADOW are as in
                                (eq this-shadowed next-shadowed))))
               (setq vect (cdr vect))
               (setq end (caar vect))))
-          ;; Now START .. END is the range to describe next.
-          ;; Insert the string to describe the event START.
-          (insert (help--key-description-fontified (vector start) prefix))
-          (when (not (eq start end))
-            (insert " .. " (help--key-description-fontified (vector end) prefix)))
-          ;; Print a description of the definition of this character.
-          ;; Called function will take care of spacing out far enough
-          ;; for alignment purposes.
-          (if transl
-              (help--describe-translation definition)
-            (help--describe-command definition))
-          ;; Print a description of the definition of this character.
-          ;; elt_describer will take care of spacing out far enough for
-          ;; alignment purposes.
-          (when shadowed
-            (goto-char (max (1- (point)) (point-min)))
-            (insert "\n  (this binding is currently shadowed)")
-            (goto-char (min (1+ (point)) (point-max)))))
+          (when (or (not (eq start end))
+                    ;; Don't output keymap prefixes.
+                    (not (keymapp definition)))
+            (when first
+              (setq help--previous-description-column 0)
+              (insert "\n")
+              (setq first nil))
+            ;; Now START .. END is the range to describe next.
+            ;; Insert the string to describe the event START.
+            (insert (help--key-description-fontified (vector start) prefix))
+            (when (not (eq start end))
+              (insert " .. " (help--key-description-fontified (vector end)
+                                                              prefix)))
+            ;; Print a description of the definition of this character.
+            ;; Called function will take care of spacing out far enough
+            ;; for alignment purposes.
+            (if transl
+                (help--describe-translation definition)
+              (help--describe-command definition))
+            ;; Print a description of the definition of this character.
+            ;; elt_describer will take care of spacing out far enough for
+            ;; alignment purposes.
+            (when shadowed
+              (goto-char (max (1- (point)) (point-min)))
+              (insert "\n  (this binding is currently shadowed)")
+              (goto-char (min (1+ (point)) (point-max))))))
         ;; Next item in list.
         (setq vect (cdr vect))))))
 
index 05ade12cf195fbfe54c54f197cb4903039e70487..1234e5fb2931de32412a2cceb97ce05eb3fb57a4 100644 (file)
@@ -98,7 +98,6 @@ C-g           abort-minibuffers
 TAB            minibuffer-complete
 C-j            minibuffer-complete-and-exit
 RET            minibuffer-complete-and-exit
-ESC            Prefix Command
 SPC            minibuffer-complete-word
 ?              minibuffer-completion-help
 C-<tab>                file-cache-minibuffer-complete
@@ -109,11 +108,8 @@ C-<tab>            file-cache-minibuffer-complete
 <prior>                switch-to-completions
 <up>           previous-line-or-history-element
 
-M-g            Prefix Command
 M-v            switch-to-completions
 
-M-g ESC                Prefix Command
-
 M-<            minibuffer-beginning-of-buffer
 M-n            next-history-element
 M-p            previous-history-element
@@ -290,8 +286,6 @@ x           foo-original
             "
 Key             Binding
 -------------------------------------------------------------------------------
-<remap>                Prefix Command
-
 <remap> <foo>  bar
 ")))))
 
@@ -323,7 +317,6 @@ C-a         foo
 Key             Binding
 -------------------------------------------------------------------------------
 C-a            foo
-<menu-bar>     Prefix Command
 
 <menu-bar> <foo>               foo
 ")))))