Variable: which-key-mode

which-key-mode is a customizable variable defined in which-key.el.gz.

Value

nil

Documentation

Non-nil if Which-Key mode is enabled.

See the which-key-mode(var)/which-key-mode(fun) command for a description of this minor mode. Setting this variable directly does not take effect; either customize it (see the info node (emacs)Easy Customization) or call the function which-key-mode(var)/which-key-mode(fun).

Probably introduced at or before Emacs version 30.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/which-key.el.gz
;;; Mode

;;;###autoload
(define-minor-mode which-key-mode
  "Toggle `which-key-mode'.

`which-key' is a minor mode that displays the key bindings following
your currently entered incomplete command (a prefix) in a popup.

For example, after enabling the minor mode, if you enter \\`C-x' and
wait for one second (by default), the minibuffer will expand with all
available key bindings that follow \\`C-x' (or as many as space allows
given your settings)."
  :global t
  :group 'which-key
  :lighter which-key-lighter
  :keymap (let ((map (make-sparse-keymap)))
            (mapc
             (lambda (prefix)
               (define-key map
                 (kbd (concat prefix " " which-key-paging-key))
                 #'which-key-C-h-dispatch))
             which-key-paging-prefixes)
            map)
  (if which-key-mode
      (progn
        (setq which-key--echo-keystrokes-backup echo-keystrokes)
        (when (or (eq which-key-show-prefix 'echo)
                  (eq which-key-popup-type 'minibuffer))
          (which-key--setup-echo-keystrokes))
        (unless (member prefix-help-command which-key--paging-functions)
          (setq which-key--prefix-help-cmd-backup prefix-help-command))
        (when (or which-key-use-C-h-commands
                  which-key-show-early-on-C-h)
          (setq prefix-help-command #'which-key-C-h-dispatch))
        (when which-key-show-remaining-keys
          (add-hook 'pre-command-hook #'which-key--lighter-restore))
        (add-hook 'pre-command-hook #'which-key--hide-popup)
        (add-hook 'window-size-change-functions
                  #'which-key--hide-popup-on-frame-size-change)
        (which-key--start-timer))
    (setq echo-keystrokes which-key--echo-keystrokes-backup)
    (when which-key--prefix-help-cmd-backup
      (setq prefix-help-command which-key--prefix-help-cmd-backup))
    (when which-key-show-remaining-keys
      (remove-hook 'pre-command-hook #'which-key--lighter-restore))
    (remove-hook 'pre-command-hook #'which-key--hide-popup)
    (remove-hook 'window-size-change-functions
                 #'which-key--hide-popup-on-frame-size-change)
    (which-key--stop-timer)))