(let ((vect (sort vect 'help--describe-map-compare))
(columns ())
line-start key-end column)
+ ;; If we're in a <remap> section of the output, then also
+ ;; display the bindings of the keys that we've remapped from.
+ ;; This enables the user to actually see what keys to tap to
+ ;; execute the remapped commands.
+ (when (equal prefix [remap])
+ (dolist (binding (prog1 vect
+ (setq vect nil)))
+ (push binding vect)
+ (when-let ((other (and (not (eq (car binding) 'self-insert-command))
+ (car (where-is-internal (car binding))))))
+ (push (list (elt other (1- (length other)))
+ (car binding)
+ nil
+ (seq-into (butlast (seq-into other 'list)) 'vector))
+ vect)))
+ (setq vect (nreverse vect)))
;; Now output them in sorted order.
(while vect
(let* ((elem (car vect))
- (start (car elem))
- (definition (cadr elem))
- (shadowed (caddr elem))
+ (start (nth 0 elem))
+ (definition (nth 1 elem))
+ (shadowed (nth 2 elem))
+ ;; We override the prefix for the <remap> extra commands.
+ (prefix (or (nth 3 elem) prefix))
(end start))
;; Find consecutive chars that are identically defined.
(when (fixnump start)