From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "B. T. Raven" Newsgroups: gmane.emacs.help Subject: Re: emacs keybinding syntaxes bewilderment Date: Fri, 14 Dec 2007 17:15:57 -0600 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1197769337 22433 80.91.229.12 (16 Dec 2007 01:42:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 16 Dec 2007 01:42:17 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Dec 16 02:42:28 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1J3iWQ-0005Fr-Vi for geh-help-gnu-emacs@m.gmane.org; Sun, 16 Dec 2007 02:42:28 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J3iWF-00056U-UU for geh-help-gnu-emacs@m.gmane.org; Sat, 15 Dec 2007 20:42:16 -0500 Original-Path: shelby.stanford.edu!headwall.stanford.edu!newsfeed.news2me.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.sysmatrix.net!news.sysmatrix.net.POSTED!not-for-mail Original-NNTP-Posting-Date: Fri, 14 Dec 2007 17:16:09 -0600 User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) Original-Newsgroups: gnu.emacs.help,comp.emacs In-Reply-To: Original-Lines: 115 X-Usenet-Provider: http://www.giganews.com Original-NNTP-Posting-Host: 65.45.140.44 Original-X-Trace: sv3-0qE28GRk8Ach2pBxzRSwvGHRIYZNtqK60YMwORlQucf8TwtruyaT27N+ahYIxOYFZ3jgXShZK3yWUq2!G0VxHy97RRNTOpTOruLM97rhwFhGahjRUBcsDd2tZETZpEQUjd/MfwSycgQfbanC0gi86sxkHeWN!BCinMtMl5jKlvZFRqPa86rBLWezZ7Q== Original-X-Complaints-To: abuse@sysmatrix.net X-DMCA-Complaints-To: abuse@sysmatrix.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.36 Original-Xref: shelby.stanford.edu gnu.emacs.help:154665 comp.emacs:95957 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:50093 Archived-At: Xah Lee wrote: > 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 "") '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-") '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 > xah@xahlee.org > $B-t(B http://xahlee.org/ Yes. I have the following in my .emacs: (setq w32-pass-lwindow-to-system nil w32-pass-rwindow-to-system nil w32-pass-apps-to-system nil w32-lwindow-modifier 'super ;; Left Windows w32-rwindow-modifier 'super ;; Right Windows w32-apps-modifier 'hyper) ;; App-Menu (key to right of Right Windows) In addition I have used Keytweak (on w2000 or better (later, whatever)changes registry scancode interpretations) to make the order of the modifiers in bottom row super alt control spacebar control alt super hyper. For this to work you need a keyboard where all the modifier keycaps can be swapped around. Since I used the Dvorak layout, even with these hacks, the best I can do to be able to touch type keychords and get any ergonomic effect is to redefine these keys: ;; Single char cursor movement on Dvorak layout (global-set-key [(meta h)] 'backward-char) (global-set-key [(meta n)] 'forward-char) (global-set-key [(meta c)] 'previous-line) (global-set-key [(meta t)] 'next-line) ;;substitute for stolen metakeychords (global-set-key [(control p)] 'mark-paragraph) (global-set-key [(control b)] 'capitalize-word) (global-set-key [(control f)] 'find-function-at-point) (global-set-key [(shift control f)] 'find-variable-at-point) What I really want is for those first four bindings to be used with the Ctrl modifier rather than Meta, but the C-h and C-c prefixes preclude that possibility. Ed