Function: which-key--maybe-get-prefix-title

which-key--maybe-get-prefix-title is a byte-compiled function defined in which-key.el.gz.

Signature

(which-key--maybe-get-prefix-title KEYS)

Documentation

KEYS is a string produced by key-description.

A title is possibly returned using which-key--prefix-title-alist. An empty string is returned if no title exists.

Source Code

;; Defined in /usr/src/emacs/lisp/which-key.el.gz
(defun which-key--maybe-get-prefix-title (keys)
  "KEYS is a string produced by `key-description'.
A title is possibly returned using
`which-key--prefix-title-alist'.  An empty string is returned if
no title exists."
  (cond
   ((not (string-equal keys ""))
    (let* ((title-res
            (cdr-safe (assoc-string keys which-key--prefix-title-alist)))
           (repl-res
            (cdr-safe (which-key--maybe-replace (cons keys ""))))
           (binding (key-binding (kbd keys)))
           (alternate (when (and binding (symbolp binding))
                        (symbol-name binding))))
      (cond (title-res title-res)
            ((not (string-empty-p repl-res)) repl-res)
            ((and (eq which-key-show-prefix 'echo) alternate)
             alternate)
            ((and (member which-key-show-prefix '(bottom top mode-line))
                  (eq which-key-side-window-location 'bottom)
                  echo-keystrokes)
             (if alternate alternate
               (concat "Following " keys)))
            (t ""))))
   (t "")))