0

This is my config file. I frequently use C-k which is bounded to paredit-kill.

In general, it works. However, it does not work when I am typing in the minibuffer. For instance, after executing C-x C-f (bounded to counsel-find-file), I can start typing something, then execute C-a moving the cursor to the beginning, and C-k does not work as expected, since it does not delete text.

Why is paredit-kill not working on the mini-buffer?

Obs.: I am using this on MacOS.

1
  • 1
    I don't use use paredit, so I'm not sure what C-k does. But my educated guess says it does the same that C-M-k does.
    – aadcg
    Commented Jan 26, 2023 at 8:29

1 Answer 1

2

Because the minibuffer's major mode is minibuffer-mode which has a different keymap than whatever mode you are using for the "normal" buffer. You could try (but you shouldn't - DAMHIKT) enabling paredit-mode in the usual way in your minibuffer - like this:

(add-hook 'minibuffer-mode-hook #'paredit-mode)

The problem with that is that the minor mode keymap (i.e. paredit-mode-map in this case) would shadow the major mode keymap (i.e. minibuffer-mode-map in this case), and since the minor mode keymap binds things like RET, it would wreak havoc on the minibuffer's operations; e.g. RET is bound to minibuffer-complete-and-exit in the minibuffer-mode keymap but if you enable the minor mode, it would be bound to paredit-RET, a different function that knows nothing about the minibuffer or how to exit it.

You might want to try selectively modifying the major mode keymap to modify just the C-k binding (which, incidentally, is not defined in this keymap: it is picked up from the global map - see Active keymaps in the Elisp Reference manual):

(define-key minibuffer-mode-map (kbd "C-k") #'paredit-kill)

or you can, if you want, redefine it in global-map so that any mode that does not define it on its own, will pick it up from the global map (however, if it it does define it on its own, then you'll have to do some digging to find out which map you have to modify).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.