Closed haji-ali closed 3 years ago
I read more about define-globalized-minor-mode
. One way to resolve this is
(add-hook 'minibuffer-setup-hook
(lambda () (when (not ctrlf--active-p)
(ctrlf-local-mode -1))))
I think this should be done by default. There is no good reason for CTRLF to be active in the minibuffer.
OK, so:
(define-key minibuffer-local-map (kbd "C-s") (lambda () (interactive) (message "Hello")))
in my testing just now will override C-s
in the minibuffer outside of a CTRLF session.You shouldn't have to disable CTRLF in the minibuffer explicitly for the above to work.
Hmmm.. That's exactly what I tried in the beginning and it didn't work for me (CTRLF is still called when I press C-s
, despite the fact that I see the correct binding when inspecting minibuffer-local-map
).
I am using Radian for my config which enables the global mode of CTRLF. The documentation of define-globalized-minor-mode
, which is used in CTRLF, says that "When a major mode is initialized, MODE is actually turned on just after running the major mode's hook. However, MODE is not turned on if the hook has explicitly disabled it."
So if I am understanding this correctly, the CTRLF mode is turned on after the minibuffer mode and the keybindings in minibuffer-local-map
are overridden. That is why disabling CTRLF worked for me (although I had to change the code a little to make sure CTRLF is not disabled in a CTRLF session).
This is probably a Radian bug, then, so I'll transfer the issue. Radian may have still been on an old commit of CTRLF. I've pushed a new commit to develop
updating the lockfile to the latest version of CTRLF. Try now? (M-x straight-thaw-versions
)
Updating worked and remapping C-s
is now possible!
As a plus, when I don't override it, pressing C-s
now searches the active buffer instead of the minibuffer.
I use
selectrum
for minibuffer completion and so I rarely need to search for a string in the minibuffer. I would like to disable ctrlf bindings there (to use the key sequences for more useful commands, in that context).Is this possible at all? In particular, it seems that ctrlf bindings override local ones. This might be related to raxod502/ctrlf#62 and raxod502/ctrlf#64, but I am not sure.