diff options
| -rw-r--r-- | lisp/help.el | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/lisp/help.el b/lisp/help.el index 1faebdf461d..4e0d807cb2c 100644 --- a/lisp/help.el +++ b/lisp/help.el | |||
| @@ -1503,12 +1503,30 @@ in `describe-map-tree'." | |||
| 1503 | (let ((vect (sort vect 'help--describe-map-compare)) | 1503 | (let ((vect (sort vect 'help--describe-map-compare)) |
| 1504 | (columns ()) | 1504 | (columns ()) |
| 1505 | line-start key-end column) | 1505 | line-start key-end column) |
| 1506 | ;; If we're in a <remap> section of the output, then also | ||
| 1507 | ;; display the bindings of the keys that we've remapped from. | ||
| 1508 | ;; This enables the user to actually see what keys to tap to | ||
| 1509 | ;; execute the remapped commands. | ||
| 1510 | (when (equal prefix [remap]) | ||
| 1511 | (dolist (binding (prog1 vect | ||
| 1512 | (setq vect nil))) | ||
| 1513 | (push binding vect) | ||
| 1514 | (when-let ((other (and (not (eq (car binding) 'self-insert-command)) | ||
| 1515 | (car (where-is-internal (car binding)))))) | ||
| 1516 | (push (list (elt other (1- (length other))) | ||
| 1517 | (car binding) | ||
| 1518 | nil | ||
| 1519 | (seq-into (butlast (seq-into other 'list)) 'vector)) | ||
| 1520 | vect))) | ||
| 1521 | (setq vect (nreverse vect))) | ||
| 1506 | ;; Now output them in sorted order. | 1522 | ;; Now output them in sorted order. |
| 1507 | (while vect | 1523 | (while vect |
| 1508 | (let* ((elem (car vect)) | 1524 | (let* ((elem (car vect)) |
| 1509 | (start (car elem)) | 1525 | (start (nth 0 elem)) |
| 1510 | (definition (cadr elem)) | 1526 | (definition (nth 1 elem)) |
| 1511 | (shadowed (caddr elem)) | 1527 | (shadowed (nth 2 elem)) |
| 1528 | ;; We override the prefix for the <remap> extra commands. | ||
| 1529 | (prefix (or (nth 3 elem) prefix)) | ||
| 1512 | (end start)) | 1530 | (end start)) |
| 1513 | ;; Find consecutive chars that are identically defined. | 1531 | ;; Find consecutive chars that are identically defined. |
| 1514 | (when (fixnump start) | 1532 | (when (fixnump start) |