emacs-diffs
[Top][All Lists]
Advanced

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

master a5d79fc: Don't output prefix keys in `C-h b', and output more dat


From: Lars Ingebrigtsen
Subject: master a5d79fc: Don't output prefix keys in `C-h b', and output more data on objects
Date: Mon, 1 Nov 2021 11:06:26 -0400 (EDT)

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

    Don't output prefix keys in `C-h b', and output more data on objects
    
    * 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                |  6 ++++++
 lisp/help.el            | 56 +++++++++++++++++++++++++++++--------------------
 test/lisp/help-tests.el |  7 -------
 3 files changed, 39 insertions(+), 30 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 0aff356..114441f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -307,6 +307,12 @@ Emacs buffers, like indentation and the like.  The new ert 
function
 
 * 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
diff --git a/lisp/help.el b/lisp/help.el
index acd8a12..293dd44 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -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))))))
 
diff --git a/test/lisp/help-tests.el b/test/lisp/help-tests.el
index 05ade12..1234e5f 100644
--- a/test/lisp/help-tests.el
+++ b/test/lisp/help-tests.el
@@ -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
 ")))))



reply via email to

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