diff options
| author | Lars Ingebrigtsen | 2021-11-01 16:06:16 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2021-11-01 16:06:21 +0100 |
| commit | a5d79fcfe83e3b87a5f044d062afb8d828bfa7b2 (patch) | |
| tree | bc849f70b6c184ba1dc334d2ac53e2aac036c2f8 | |
| parent | aa90de71a2d3344884a2622ceef00507bcdf28d2 (diff) | |
| download | emacs-a5d79fcfe83e3b87a5f044d062afb8d828bfa7b2.tar.gz emacs-a5d79fcfe83e3b87a5f044d062afb8d828bfa7b2.zip | |
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.
| -rw-r--r-- | etc/NEWS | 6 | ||||
| -rw-r--r-- | lisp/help.el | 56 | ||||
| -rw-r--r-- | test/lisp/help-tests.el | 7 |
3 files changed, 39 insertions, 30 deletions
| @@ -307,6 +307,12 @@ Emacs buffers, like indentation and the like. The new ert function | |||
| 307 | 307 | ||
| 308 | * Incompatible Lisp Changes in Emacs 29.1 | 308 | * Incompatible Lisp Changes in Emacs 29.1 |
| 309 | 309 | ||
| 310 | ** Keymap descriptions have changed. | ||
| 311 | 'help--describe-command', 'C-h b' and associated functions that output | ||
| 312 | keymap descriptions have changed. In particular, prefix commands are | ||
| 313 | not output at all, and instead of "??" for closures/functions, | ||
| 314 | "[closure]"/"[lambda]" is output. | ||
| 315 | |||
| 310 | --- | 316 | --- |
| 311 | ** 'downcase' details have changed slightly. | 317 | ** 'downcase' details have changed slightly. |
| 312 | In certain locales, changing the case of an ASCII-range character may | 318 | In certain locales, changing the case of an ASCII-range character may |
diff --git a/lisp/help.el b/lisp/help.el index acd8a123ab5..293dd445459 100644 --- a/lisp/help.el +++ b/lisp/help.el | |||
| @@ -1357,7 +1357,13 @@ Return nil if the key sequence is too long." | |||
| 1357 | (insert "Keyboard Macro\n")) | 1357 | (insert "Keyboard Macro\n")) |
| 1358 | ((keymapp definition) | 1358 | ((keymapp definition) |
| 1359 | (insert "Prefix Command\n")) | 1359 | (insert "Prefix Command\n")) |
| 1360 | (t (insert "??\n"))))) | 1360 | ((byte-code-function-p definition) |
| 1361 | (insert "[byte-code]\n")) | ||
| 1362 | ((and (consp definition) | ||
| 1363 | (memq (car definition) '(closure lambda))) | ||
| 1364 | (insert (format "[%s]\n" (car definition)))) | ||
| 1365 | (t | ||
| 1366 | (insert "??\n"))))) | ||
| 1361 | 1367 | ||
| 1362 | (defun help--describe-translation (definition) | 1368 | (defun help--describe-translation (definition) |
| 1363 | ;; Converted from describe_translation in keymap.c. | 1369 | ;; Converted from describe_translation in keymap.c. |
| @@ -1456,10 +1462,6 @@ TRANSL, PARTIAL, SHADOW, NOMENU, MENTION-SHADOW are as in | |||
| 1456 | (definition (cadr elem)) | 1462 | (definition (cadr elem)) |
| 1457 | (shadowed (caddr elem)) | 1463 | (shadowed (caddr elem)) |
| 1458 | (end start)) | 1464 | (end start)) |
| 1459 | (when first | ||
| 1460 | (setq help--previous-description-column 0) | ||
| 1461 | (insert "\n") | ||
| 1462 | (setq first nil)) | ||
| 1463 | ;; Find consecutive chars that are identically defined. | 1465 | ;; Find consecutive chars that are identically defined. |
| 1464 | (when (fixnump start) | 1466 | (when (fixnump start) |
| 1465 | (while (and (cdr vect) | 1467 | (while (and (cdr vect) |
| @@ -1474,24 +1476,32 @@ TRANSL, PARTIAL, SHADOW, NOMENU, MENTION-SHADOW are as in | |||
| 1474 | (eq this-shadowed next-shadowed)))) | 1476 | (eq this-shadowed next-shadowed)))) |
| 1475 | (setq vect (cdr vect)) | 1477 | (setq vect (cdr vect)) |
| 1476 | (setq end (caar vect)))) | 1478 | (setq end (caar vect)))) |
| 1477 | ;; Now START .. END is the range to describe next. | 1479 | (when (or (not (eq start end)) |
| 1478 | ;; Insert the string to describe the event START. | 1480 | ;; Don't output keymap prefixes. |
| 1479 | (insert (help--key-description-fontified (vector start) prefix)) | 1481 | (not (keymapp definition))) |
| 1480 | (when (not (eq start end)) | 1482 | (when first |
| 1481 | (insert " .. " (help--key-description-fontified (vector end) prefix))) | 1483 | (setq help--previous-description-column 0) |
| 1482 | ;; Print a description of the definition of this character. | 1484 | (insert "\n") |
| 1483 | ;; Called function will take care of spacing out far enough | 1485 | (setq first nil)) |
| 1484 | ;; for alignment purposes. | 1486 | ;; Now START .. END is the range to describe next. |
| 1485 | (if transl | 1487 | ;; Insert the string to describe the event START. |
| 1486 | (help--describe-translation definition) | 1488 | (insert (help--key-description-fontified (vector start) prefix)) |
| 1487 | (help--describe-command definition)) | 1489 | (when (not (eq start end)) |
| 1488 | ;; Print a description of the definition of this character. | 1490 | (insert " .. " (help--key-description-fontified (vector end) |
| 1489 | ;; elt_describer will take care of spacing out far enough for | 1491 | prefix))) |
| 1490 | ;; alignment purposes. | 1492 | ;; Print a description of the definition of this character. |
| 1491 | (when shadowed | 1493 | ;; Called function will take care of spacing out far enough |
| 1492 | (goto-char (max (1- (point)) (point-min))) | 1494 | ;; for alignment purposes. |
| 1493 | (insert "\n (this binding is currently shadowed)") | 1495 | (if transl |
| 1494 | (goto-char (min (1+ (point)) (point-max))))) | 1496 | (help--describe-translation definition) |
| 1497 | (help--describe-command definition)) | ||
| 1498 | ;; Print a description of the definition of this character. | ||
| 1499 | ;; elt_describer will take care of spacing out far enough for | ||
| 1500 | ;; alignment purposes. | ||
| 1501 | (when shadowed | ||
| 1502 | (goto-char (max (1- (point)) (point-min))) | ||
| 1503 | (insert "\n (this binding is currently shadowed)") | ||
| 1504 | (goto-char (min (1+ (point)) (point-max)))))) | ||
| 1495 | ;; Next item in list. | 1505 | ;; Next item in list. |
| 1496 | (setq vect (cdr vect)))))) | 1506 | (setq vect (cdr vect)))))) |
| 1497 | 1507 | ||
diff --git a/test/lisp/help-tests.el b/test/lisp/help-tests.el index 05ade12cf19..1234e5fb293 100644 --- a/test/lisp/help-tests.el +++ b/test/lisp/help-tests.el | |||
| @@ -98,7 +98,6 @@ C-g abort-minibuffers | |||
| 98 | TAB minibuffer-complete | 98 | TAB minibuffer-complete |
| 99 | C-j minibuffer-complete-and-exit | 99 | C-j minibuffer-complete-and-exit |
| 100 | RET minibuffer-complete-and-exit | 100 | RET minibuffer-complete-and-exit |
| 101 | ESC Prefix Command | ||
| 102 | SPC minibuffer-complete-word | 101 | SPC minibuffer-complete-word |
| 103 | ? minibuffer-completion-help | 102 | ? minibuffer-completion-help |
| 104 | C-<tab> file-cache-minibuffer-complete | 103 | C-<tab> file-cache-minibuffer-complete |
| @@ -109,11 +108,8 @@ C-<tab> file-cache-minibuffer-complete | |||
| 109 | <prior> switch-to-completions | 108 | <prior> switch-to-completions |
| 110 | <up> previous-line-or-history-element | 109 | <up> previous-line-or-history-element |
| 111 | 110 | ||
| 112 | M-g Prefix Command | ||
| 113 | M-v switch-to-completions | 111 | M-v switch-to-completions |
| 114 | 112 | ||
| 115 | M-g ESC Prefix Command | ||
| 116 | |||
| 117 | M-< minibuffer-beginning-of-buffer | 113 | M-< minibuffer-beginning-of-buffer |
| 118 | M-n next-history-element | 114 | M-n next-history-element |
| 119 | M-p previous-history-element | 115 | M-p previous-history-element |
| @@ -290,8 +286,6 @@ x foo-original | |||
| 290 | " | 286 | " |
| 291 | Key Binding | 287 | Key Binding |
| 292 | ------------------------------------------------------------------------------- | 288 | ------------------------------------------------------------------------------- |
| 293 | <remap> Prefix Command | ||
| 294 | |||
| 295 | <remap> <foo> bar | 289 | <remap> <foo> bar |
| 296 | "))))) | 290 | "))))) |
| 297 | 291 | ||
| @@ -323,7 +317,6 @@ C-a foo | |||
| 323 | Key Binding | 317 | Key Binding |
| 324 | ------------------------------------------------------------------------------- | 318 | ------------------------------------------------------------------------------- |
| 325 | C-a foo | 319 | C-a foo |
| 326 | <menu-bar> Prefix Command | ||
| 327 | 320 | ||
| 328 | <menu-bar> <foo> foo | 321 | <menu-bar> <foo> foo |
| 329 | "))))) | 322 | "))))) |