~ruther/emacs.d

b17aaed7b214da62a6f3f21073cac25d7e71b4f5 — Rutherther 11 days ago 171ea46
feat: Make keyboard-quit smarter
1 files changed, 16 insertions(+), 0 deletions(-)

M init.el
M init.el => init.el +16 -0
@@ 1182,6 1182,22 @@
  :config
  (which-function-mode 1)

  ;; Taken from https://emacsredux.com/blog/2025/06/01/let-s-make-keyboard-quit-smarter/
  (defun er-keyboard-quit ()
    "Smater version of the built-in `keyboard-quit'.

The generic `keyboard-quit' does not do the expected thing when
the minibuffer is open.  Whereas we want it to close the
minibuffer, even without explicitly focusing it."
    (interactive)
    (if (active-minibuffer-window)
        (if (minibufferp)
            (minibuffer-keyboard-quit)
          (abort-recursive-edit))
      (keyboard-quit)))

  (global-set-key [remap keyboard-quit] #'er-keyboard-quit)

  (defun my/which-func-try-to-enable ()
    (unless (or (not which-function-mode)
                (local-variable-p 'which-func-mode))

Do not follow this link