Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Super key binding in emacs

(global-set-key (kbd "<s-d>") 'duplicate-line)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ECB MODE;;;;;;;;;;;;;;;;;;;;;
(global-set-key (kbd "<s-left>") 'ecb-goto-window-methods)
(global-set-key (kbd "<s-right>") 'ecb-goto-window-edit1)
(global-set-key (kbd "<s-down>") 'ecb-goto-window-history)
(global-set-key (kbd "<s-up>") 'ecb-goto-window-sources)
(global-set-key (kbd "<s-home>") 'ecb-goto-window-directories)

This is part of my .emacs file. I am facing a strange problem while binding a key combination containing super key. Whenever I bind a function to super-key + <alphanumberic value> it refuses to work.
In the above file all the bindings except <s-d> are working fine.
I am using emacs 24.3 on fedora 13

like image 374
Kaunteya Avatar asked Sep 25 '13 05:09

Kaunteya


1 Answers

The reason the kbd macro is so convenient is that the argument you pass it is exactly the same thing that Emacs tells you when you ask about a key binding. You're guessing at the argument, but you never need to do that.

When you type C-hk (or C-hc) and then the key sequence in question, Emacs will display a message describing that binding. In this instance it will describe super-key + d as s-d.

Therefore you can use (kbd "s-d") to refer to it.

  • Ask Emacs to describe a key sequence
  • Plug the answer into kbd
like image 84
phils Avatar answered Oct 14 '22 21:10

phils