Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable ctrl-f bindings in the minibuffer #476

Closed
haji-ali opened this issue Mar 13, 2021 · 6 comments
Closed

Disable ctrl-f bindings in the minibuffer #476

haji-ali opened this issue Mar 13, 2021 · 6 comments
Labels

Comments

@haji-ali
Copy link
Contributor

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 radian-software/ctrlf#62 and radian-software/ctrlf#64, but I am not sure.

@haji-ali
Copy link
Contributor Author

haji-ali commented Mar 13, 2021

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))))

@raxod502
Copy link
Member

I think this should be done by default. There is no good reason for CTRLF to be active in the minibuffer.

@raxod502 raxod502 reopened this Mar 14, 2021
@raxod502
Copy link
Member

OK, so:

  • by default using CTRLF in the minibuffer outside of a CTRLF session will do Isearch instead, like in vanilla Emacs
  • the default CTRLF bindings can be overridden by user bindings, e.g. (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.

@haji-ali
Copy link
Contributor Author

haji-ali commented Mar 15, 2021

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).

@raxod502 raxod502 transferred this issue from radian-software/ctrlf Mar 21, 2021
@raxod502
Copy link
Member

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)

@raxod502 raxod502 added the ctrlf label Mar 21, 2021
@haji-ali
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants