Function: help--append-keystrokes-help

help--append-keystrokes-help is a byte-compiled function defined in help.el.gz.

Signature

(help--append-keystrokes-help STR)

Source Code

;; Defined in /usr/src/emacs/lisp/help.el.gz
(defun help--append-keystrokes-help (str)
  (let* ((keys (this-single-command-keys))
         (bindings (delete nil
                           (mapcar (lambda (map) (lookup-key map keys t))
                                   (current-active-maps t)))))
    (catch 'res
      (dolist (val help-event-list)
        (when (setq val (if (eql val 'help) help-char val))
          (let ((key (vector val)))
            (unless (seq-find (lambda (map) (and (keymapp map) (lookup-key map key)))
                              bindings)
              (throw 'res
                     (concat
                      str
                      (substitute-command-keys
                       (format
                        " (\\`%s' for help)"
                        (key-description key)))))))))
      str)))