Function: which-key--update

which-key--update is a byte-compiled function defined in which-key.el.gz.

Signature

(which-key--update)

Documentation

Function run by timer to possibly trigger which-key--create-buffer-and-show.

Source Code

;; Defined in /usr/src/emacs/lisp/which-key.el.gz
(defun which-key--update ()
  "Function run by timer to possibly trigger `which-key--create-buffer-and-show'."
  (let ((prefix-keys (funcall which-key-this-command-keys-function))
        delay-time)
    (cond ((and (> (length prefix-keys) 0)
                (or (keymapp (key-binding prefix-keys))
                    ;; Some keymaps are stored here like iso-transl-ctl-x-8-map
                    (keymapp (which-key--safe-lookup-key
                              key-translation-map prefix-keys))
                    ;; just in case someone uses one of these
                    (keymapp (which-key--safe-lookup-key
                              function-key-map prefix-keys)))
                (not which-key-inhibit)
                (or (null which-key-allow-regexps)
                    (which-key--any-match-p
                     which-key-allow-regexps (key-description prefix-keys)))
                (or (null which-key-inhibit-regexps)
                    (not
                     (which-key--any-match-p
                      which-key-inhibit-regexps (key-description prefix-keys))))
                ;; Do not display the popup if a command is currently being
                ;; executed
                (or (run-hook-with-args-until-success
                     'which-key-inhibit-display-hook)
                    (null this-command))
                (let ((max-dim (which-key--popup-max-dimensions)))
                  (> (min (car-safe max-dim) (cdr-safe max-dim)) 0)))
           (when (and (not (equal prefix-keys (which-key--current-prefix)))
                      (or (null which-key-delay-functions)
                          (null (setq delay-time
                                      (run-hook-with-args-until-success
                                       'which-key-delay-functions
                                       (key-description prefix-keys)
                                       (length prefix-keys))))
                          (sit-for delay-time)))
             (setq which-key--automatic-display t)
             (which-key--create-buffer-and-show prefix-keys)
             (when (and which-key-idle-secondary-delay
                        (not which-key--secondary-timer-active))
               (which-key--start-timer which-key-idle-secondary-delay t))))
          ((and which-key-show-transient-maps
                ;; Assuming that if this is not true we're in
                ;; `which-key-show-top-level', which would then be overwritten.
                (> (length prefix-keys) 0)
                (keymapp overriding-terminal-local-map)
                ;; basic test for it being a hydra
                (not (eq (lookup-key overriding-terminal-local-map "\C-u")
                         'hydra--universal-argument)))
           (which-key--create-buffer-and-show
            nil overriding-terminal-local-map))
          ((and which-key-show-operator-state-maps
                (bound-and-true-p evil-state)
                (eq evil-state 'operator)
                (not (which-key--popup-showing-p)))
           (which-key--show-evil-operator-keymap))
          (which-key--automatic-display
           (which-key--hide-popup)))))