emacs-which-key icon indicating copy to clipboard operation
emacs-which-key copied to clipboard

Provide mechanism to disable for some modes

Open alephnull opened this issue 4 years ago • 4 comments

Like markdown-mode already has excellent prompt support when you are editing and which-key takes it over. I tried setting up a local variable in markdown-mode-hook like:

(lambda () 
   (setq-local which-key-idle-delay 60))

and I can see that the variable is set in buffer but w-k seems to be using the default value. ANy other way of disabling also welcome.

alephnull avatar Mar 21 '20 17:03 alephnull

That won't work unless you reset the timer each time you enter and exit the buffer.

You could try something like this instead

(add-hook 'which-key-delay-functions
          (lambda (_ _)
            (when (eq major-mode 'markdown-mode)
              1000))
          nil t)

justbur avatar Mar 28 '20 15:03 justbur

@alephnull you can set markdown-enable-prefix-prompts to nil instead :)

a13 avatar May 14 '21 23:05 a13

The which-key-delay-functions trick works well and is very helpful for me in vterm. Add this to the docs maybe?

betaprior avatar Jan 19 '22 11:01 betaprior

Seconded on the delay functions trick as a solution in vterm, though I feel a list of disabled modes would be a cleaner solution.

Here's my take on a 2s added delay to make evil and leader keybindings work in vterm with doom emacs without which-key interfering with the cursor placement.

(after! which-key
  (defun t/delayed-which-key (_ _)
    (cond
     ((eq major-mode 'vterm-mode) 2)
     (t nil)))
  (add-hook! 'which-key-delay-functions #'t/delayed-which-key))

torgeir avatar Feb 25 '23 20:02 torgeir