`define-key helm-map` works for C-i but not M-i

56 views
Skip to first unread message

Brett Wines

unread,
Apr 5, 2020, 1:50:48 AM4/5/20
to emacs-helm
Hi, there,

Thanks in advance for your help! I'm relatively new to emacs so if you have an tips for how I can debug this kind of thing on my own in the future I'd love to hear your input :)

I have the following code in my .spacemacs file:

  (global-set-key (kbd "C-i") 'delete-backward-char)
  (global-set-key (kbd "M-i") '
subword-backward-kill)
 
(global-set-key (kbd "M-I") 'backward-kill-sexp)

When I activate Helm with C-x C-f, I'd like to use M-i, but it doesn't behave as I would expect (more on that below), presumably because Helm has ascribed it a binding it for its own purposes. I attempted to override that as follows:

  (with-eval-after-load 'helm
    (define-key helm-map (kbd "C-i")
'delete-backward-char)  ;; this works
   
(define-key helm-map (kbd "M-i") 'subword-backward-kill)) ;; this doesn't work

Interestingly, C-i behaves as I would expect but M-i does not; it prints some output that looks like it would come from ls -l or something.

I tried assigning C-i to 'subword-backward-kill and it does indeed execute that commfand, so the issue is not with the function to execute but rather the keystroke.

Does anyone have thoughts on how I can go about binding M-i? Thank you so much!

Sincerely,
Brett

P.S. hope everybody is managing to stay healthy

Thierry Volpiatto

unread,
Apr 5, 2020, 4:56:51 AM4/5/20
to emacs...@googlegroups.com

'Brett Wines' via emacs-helm <emacs...@googlegroups.com> writes:

> When I activate Helm with C-x C-f, I'd like to use M-i, but it doesn't
> behave as I would expect

See helm-map as a global helm map, all sources have their own keymap.
For C-x C-f (helm-find-files) the map is `helm-find-files-map` and `M-i`
is bound to `helm-ff-properties-persistent`, your C-i binding is working
because it is not in use in `helm-find-files-map`.
More generally in Emacs, all the specific mode maps override the global map.

--
Thierry

Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997

Brett Wines

unread,
Apr 5, 2020, 3:14:14 PM4/5/20
to emacs...@googlegroups.com

thank you so much for your help! Much appreciated :)

Brett

--
You received this message because you are subscribed to the Google Groups "emacs-helm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emacs-helm+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emacs-helm/87blo6cnu9.fsf%40gmail.com.
Reply all
Reply to author
Forward
0 new messages