1

I am currently using emacs out of prelude and with helm-projectile enabled in my setup.

Recently I added helm-ls-git to my stack too and noticed that the function helm-browse-project is more interesting for me than the one I've been using previously helm-projectile-find-file (from helm-projectile) bound to C-c p f.

Under my config/personal.el I've added the following line and thought it should do the trick:

(global-set-key (kbd "C-c p f") 'helm-browse-project)

This is not working, but if I switch to another unused key binding such as C-c p 0 for instance, it works perfectly fine.

So, why can't I override it and what should I do in order to make that happen?

0

Load order matters. The latest global-set-key overrides the former ones. Make sure yours is evaluated after the one you want to override.

0

There are several different keymaps active for any Emacs buffer: the major-mode, any minor-modes, a buffer-local keymap, and the global keymap. The global keymap has the lowest priority - if a keybinding is defined in any of the other active keymaps, that's the binding that will be applied when you hit those keys.

In your case, C-c p f is bound in the keymap for a minor or major mode, so binding that key in the global keymap doesn't do anything useful. You can see a list of all the active keybindings for a buffer with the C-h b. Scroll through that to find the keymap where that sequence is bound. That's the one you need to modify, not the global keymap.

  • Usually the buffer local keymap is defined by the major-mode via use-local-map. – clemera Apr 22 at 8:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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