Yes we can. Sascha Chua mentions a little trick to put in your .emacs to bind Caps-Lock to M-x:
;; bind Caps-Lock to M-x ;; http://sachachua.com/wp/2008/08/04/emacs-caps-lock-as-m-x/ ;; of course, this disables normal Caps-Lock for *all* apps... (if (eq window-system 'x) (shell-command "xmodmap -e 'clear Lock' -e 'keycode 66 = F13'")) (global-set-key [f13] 'execute-extended-command)First, it remaps the Caps-Lock key to F13 using xmodmap, and then binds that to 'execute-extended-command', a.k.a, M-x. It's important to note that this will remap Caps-Lock for all your programs, not just emacs.
Also note that the above only works on X-Windows (Linux/Unix); on MS-Windows you can use Lennart Borgmans tip instead:
(setq w32-enable-caps-lock nil) (global-set-key [capslock] 'execute-extended-command)As people have mentioned, you can of course map Caps-Lock to other keys instead, for example the Control key.
1 comment:
This kills capslock in all applications, not just emacs. :(
Post a Comment