help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs keybinding syntaxes bewilderment


From: Xah Lee
Subject: emacs keybinding syntaxes bewilderment
Date: Fri, 14 Dec 2007 14:24:56 -0800 (PST)
User-agent: G2/1.0

recently i took some time to study the various syntax variations for
keybinding in emacs.
Here's a list:

 ; equivalent code for a single keystroke
 (global-set-key "b" 'func-name)
 (global-set-key [98] 'func-name)
 (global-set-key [?b] 'func-name)
 (global-set-key [(?b)] 'func-name)
 (global-set-key (kbd "b") 'func-name)

 ; equivalent code for a named special key: Enter
 (global-set-key "\r" 'func-name)
 (global-set-key [?\r] 'func-name)
 (global-set-key [13] 'func-name)
 (global-set-key [(13)] 'func-name)
 (global-set-key [return] 'func-name)
 (global-set-key [?\^M] 'func-name)
 (global-set-key [?\^m] 'func-name)
 (global-set-key [?\C-M] 'func-name)
 (global-set-key [?\C-m] 'func-name)
 (global-set-key [(?\C-m)] 'func-name)
 (global-set-key (kbd "RET") 'func-name)
 (global-set-key (kbd "<return>") 'func-name)

 ; equivalent code for binding 1 mod key + 1 letter key: Meta+b
 (global-set-key "\M-b" 'func-name)
 (global-set-key [?\M-b]  'func-name)
 (global-set-key [(meta 98)]    'func-name)
 (global-set-key [(meta b)]    'func-name)
 (global-set-key [(meta ?b)]    'func-name)
 (global-set-key (kbd "M-b") 'func-name)

 ; equivalent code for binding 1 mod key + 1 special key: Meta+Enter
 (global-set-key [M-return]    'func-name)
 (global-set-key [\M-return]    'func-name)
 (global-set-key [(meta return)]    'func-name)
 (global-set-key (kbd "M-<return>") 'func-name)

; equivalent code for binding Meta + cap letter key: Meta Shift b
 (global-set-key (kbd "M-B") 'kill-this-buffer)
 (global-set-key "\M-\S-b" 'backward-word)
 (global-set-key "\S-\M-b" 'backward-word)
 (global-set-key "\M-B" 'forward-word)

 (global-set-key [?\M-S-b] 'backward-word) ; invalid-read-syntax
 (global-set-key [?\M-?\S-b] 'forward-word) ; invalid-read-syntax
 (global-set-key [?\M-\S-b] 'forward-word) ; compile but no effect

 (global-set-key [?\M-B] 'forward-word)
 (global-set-key [\M-B] 'backward-word) ; compile but no effect

 (global-set-key [(meta shift b)] 'func-name)
 (global-set-key [(shift meta b)] 'func-name)

 (global-set-key (kbd "M-B") 'backward-word)
 (global-set-key (kbd "M-S-b") 'forward-word) ; compile but no effect

; Meta + shifted symbol key.
 (global-set-key (kbd "M-@") 'backward-word) ; good
 (global-set-key (kbd "M-S-2") 'forward-word) ; compile but no effect

What the hell!

Note: this study is not complete. I have yet to add examplary
variations for key sequences. Also, i don't fully yet understand why
some of them does not work.

Also, a question: recently i learned that to make Mac keyboard's
Option key to be hyper, i can use (setq mac-option-modifier 'hyper).
Is there something similar on Windows Emacs to make the WindowKey
hyper? Thanks.

  Xah
  address@hidden
\xAD\xF4 http://xahlee.org/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]