unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* emacs keybinding syntaxes bewilderment
@ 2007-12-14 22:24 Xah Lee
  2007-12-14 23:15 ` B. T. Raven
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Xah Lee @ 2007-12-14 22:24 UTC (permalink / raw)
  To: help-gnu-emacs

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
  xah@xahlee.org
\xAD\xF4 http://xahlee.org/

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: emacs keybinding syntaxes bewilderment
  2007-12-14 22:24 emacs keybinding syntaxes bewilderment Xah Lee
@ 2007-12-14 23:15 ` B. T. Raven
  2007-12-15  1:57   ` Xah Lee
  2007-12-15 16:48 ` rustom
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 17+ messages in thread
From: B. T. Raven @ 2007-12-14 23:15 UTC (permalink / raw)
  To: help-gnu-emacs

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 "<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
>   xah@xahlee.org
> \xAD\xF4 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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: emacs keybinding syntaxes bewilderment
  2007-12-14 23:15 ` B. T. Raven
@ 2007-12-15  1:57   ` Xah Lee
  0 siblings, 0 replies; 17+ messages in thread
From: Xah Lee @ 2007-12-15  1:57 UTC (permalink / raw)
  To: help-gnu-emacs

Thanks for the answer about how to make PC keyboard's Windows key as
Hyper.

B. T. Raven wrote:
「
;; 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)
」

Great. I did exactly the same, starting in about 1992 across Mac using
the QuicKeys utility, then with pure emacs since i stopped using
QuicKeys in about 2002.

(Mac OS X does have a system-wide scheme to rebind keys, see
http://xahlee.org/emacs/osx_keybinding.html
however, the problem is that it's not really universal, since many
apps not using Cocoa Text System will not respect it. (this includes
some major apps such as Finder, FireFox, Opera, TextWrangler... so
practically making it far less useful))

「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.」

Yeah, i understand exactly: you wanted the modifier keys for cursor
movements to be the one immediate neighbor to the space bar, so the
thumb can press it readily.

I did a fairly extensive remapping here
http://xahlee.org/emacs/ergonomic_emacs_keybinding.html

I didn't swap Control and Meta, instead, i considered the Meta-<<key>>
space free and placed all major cursor moving and editing functions to
it.

My current .emacs for keybinding are these:
http://xahlee.org/emacs/xah_emacs_kbd_shortcuts.el
http://xahlee.org/emacs/ergonomic_keybinding_dvorak.el
http://xahlee.org/emacs/xah_emacs_unicode_input.el

  Xah
  xah@xahlee.org
\xAD\xF4 http://xahlee.org/

On Dec 14, 3:15 pm, "B. T. Raven" <ni...@nihilo.net> wrote:
> 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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: emacs keybinding syntaxes bewilderment
  2007-12-14 22:24 emacs keybinding syntaxes bewilderment Xah Lee
  2007-12-14 23:15 ` B. T. Raven
@ 2007-12-15 16:48 ` rustom
  2007-12-16  7:22   ` Mike Mattie
                     ` (2 more replies)
  2007-12-18  6:12 ` Xah Lee
  2007-12-19  2:27 ` Xah
  3 siblings, 3 replies; 17+ messages in thread
From: rustom @ 2007-12-15 16:48 UTC (permalink / raw)
  To: help-gnu-emacs

On Dec 15, 3:24 am, Xah Lee <x...@xahlee.org> wrote:
> recently i took some time to study the various syntax variations for
> keybinding in emacs.
> Here's a list:
> :
> :

Thanks Xah for an informative (for me at least) rant. Ive bookmarked
it!
I am using emacs for the last 15 years but every time I try to do a
define-key or global-set-key, I have to fish around in the info pages
to get the key syntax right.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: emacs keybinding syntaxes bewilderment
  2007-12-15 16:48 ` rustom
@ 2007-12-16  7:22   ` Mike Mattie
       [not found]   ` <mailman.5061.1197789814.18990.help-gnu-emacs@gnu.org>
  2007-12-17  9:38   ` Tassilo Horn
  2 siblings, 0 replies; 17+ messages in thread
From: Mike Mattie @ 2007-12-16  7:22 UTC (permalink / raw)
  To: help-gnu-emacs


[-- Attachment #1.1: Type: text/plain, Size: 1285 bytes --]

On Sat, 15 Dec 2007 08:48:45 -0800 (PST)
rustom <rustompmody@gmail.com> wrote:

> On Dec 15, 3:24 am, Xah Lee <x...@xahlee.org> wrote:
> > recently i took some time to study the various syntax variations for
> > keybinding in emacs.
> > Here's a list:
> > :
> > :

That did confuse me for a while. I decided it was time to make it at least consistent in my
configuration. After asking for some advice I settled on (kbd). This function below takes
the pain out of keybindings.

I use it as follows:

M-x insert-key-notation

it then prompts for the key sequence, and generates the code.

(defun insert-key-notation ()
  "inject a complete \(kbd \"sequence\"\) with key notation for a key sequence given by prompt"
  (interactive)
  (insert "(kbd \"")
  (insert (format-kbd-macro (read-key-sequence "Key? " nil t)))
  (insert "\")")
  )


> Thanks Xah for an informative (for me at least) rant. Ive bookmarked
> it!
> I am using emacs for the last 15 years but every time I try to do a
> define-key or global-set-key, I have to fish around in the info pages
> to get the key syntax right.
> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: emacs keybinding syntaxes bewilderment
       [not found]   ` <mailman.5061.1197789814.18990.help-gnu-emacs@gnu.org>
@ 2007-12-16  8:25     ` rustom
  2007-12-16  8:56       ` Harald Hanche-Olsen
  0 siblings, 1 reply; 17+ messages in thread
From: rustom @ 2007-12-16  8:25 UTC (permalink / raw)
  To: help-gnu-emacs

On Dec 16, 12:22 pm, Mike Mattie <codermat...@gmail.com> wrote:
>
> That did confuse me for a while. I decided it was time to make it at least consistent in my
> configuration. After asking for some advice I settled on (kbd). This function below takes
> the pain out of keybindings.
>
> I use it as follows:
>
> M-x insert-key-notation
>
> it then prompts for the key sequence, and generates the code.
>
> (defun insert-key-notation ()
>   "inject a complete \(kbd \"sequence\"\) with key notation for a key sequence given by prompt"
>   (interactive)
>   (insert "(kbd \"")
>   (insert (format-kbd-macro (read-key-sequence "Key? " nil t)))
>   (insert "\")")
>   )

Neat! Charming!!
But why is kbd not in the elisp manual?

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: emacs keybinding syntaxes bewilderment
  2007-12-16  8:25     ` rustom
@ 2007-12-16  8:56       ` Harald Hanche-Olsen
  2007-12-16 16:39         ` rustom
  0 siblings, 1 reply; 17+ messages in thread
From: Harald Hanche-Olsen @ 2007-12-16  8:56 UTC (permalink / raw)
  To: help-gnu-emacs

+ rustom <rustompmody@gmail.com>:

> But why is kbd not in the elisp manual?

It isn't?  I found it via the index in mine.
Maybe you have an old version?

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
  when there is no ground whatsoever for supposing it is true.
  -- Bertrand Russell

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: emacs keybinding syntaxes bewilderment
  2007-12-16  8:56       ` Harald Hanche-Olsen
@ 2007-12-16 16:39         ` rustom
  2007-12-16 19:37           ` Harald Hanche-Olsen
                             ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: rustom @ 2007-12-16 16:39 UTC (permalink / raw)
  To: help-gnu-emacs

On Dec 16, 1:56 pm, Harald Hanche-Olsen <han...@math.ntnu.no> wrote:
> + rustom <rustompm...@gmail.com>:
>
> > But why is kbd not in the elisp manual?
>
> It isn't?  I found it via the index in mine.
> Maybe you have an old version?


My default emacs is 21. 22 is available as emacs-snapshot-gtk. So info
emacs gives info for 21.  Could find no packages for info of 22 (that
I could find). Strangely both 21 and 22 respond positively to describe-
function kbd. Hence the mystery.

I'm running debian etch.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: emacs keybinding syntaxes bewilderment
  2007-12-16 16:39         ` rustom
@ 2007-12-16 19:37           ` Harald Hanche-Olsen
  2007-12-16 23:21             ` Peter Dyballa
  2007-12-17 10:17           ` Sebastian Tennant
       [not found]           ` <mailman.5091.1197886901.18990.help-gnu-emacs@gnu.org>
  2 siblings, 1 reply; 17+ messages in thread
From: Harald Hanche-Olsen @ 2007-12-16 19:37 UTC (permalink / raw)
  To: help-gnu-emacs

+ rustom <rustompmody@gmail.com>:

> On Dec 16, 1:56 pm, Harald Hanche-Olsen <han...@math.ntnu.no> wrote:
>> + rustom <rustompm...@gmail.com>:
>>
>> > But why is kbd not in the elisp manual?
>>
>> It isn't?  I found it via the index in mine.
>> Maybe you have an old version?
>
> My default emacs is 21. 22 is available as emacs-snapshot-gtk.

Okay.  I admit I am running (an old version of) emacs 23, the unicode
branch.  But that version is actually older than the emacs 22 release,
so I had assumed that emacs 22 would contain info files with this
information.  Now it used to be, unless I am mistaken, that the elisp
manual used not to be distributed with the emacs source code, but came
separately.  I guess that must have changed?  But I don't know when.

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
  when there is no ground whatsoever for supposing it is true.
  -- Bertrand Russell

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: emacs keybinding syntaxes bewilderment
  2007-12-16 19:37           ` Harald Hanche-Olsen
@ 2007-12-16 23:21             ` Peter Dyballa
  2007-12-16 23:33               ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 17+ messages in thread
From: Peter Dyballa @ 2007-12-16 23:21 UTC (permalink / raw)
  To: Harald Hanche-Olsen; +Cc: help-gnu-emacs


Am 16.12.2007 um 20:37 schrieb Harald Hanche-Olsen:

> Now it used to be, unless I am mistaken, that the elisp
> manual used not to be distributed with the emacs source code, but came
> separately.  I guess that must have changed?  But I don't know when.
>


I think it was at some time in 21.3.50 from CVS, before stable GNU  
Emacs 22 was released, September or October 2007.

--
Greetings

   Pete

Engineer: a mechanism for converting caffeine into designs

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: emacs keybinding syntaxes bewilderment
  2007-12-16 23:21             ` Peter Dyballa
@ 2007-12-16 23:33               ` Lennart Borgman (gmail)
  2007-12-16 23:50                 ` Peter Dyballa
  0 siblings, 1 reply; 17+ messages in thread
From: Lennart Borgman (gmail) @ 2007-12-16 23:33 UTC (permalink / raw)
  To: Peter Dyballa; +Cc: help-gnu-emacs, Harald Hanche-Olsen

Peter Dyballa wrote:
> 
> Am 16.12.2007 um 20:37 schrieb Harald Hanche-Olsen:
> 
>> Now it used to be, unless I am mistaken, that the elisp
>> manual used not to be distributed with the emacs source code, but came
>> separately.  I guess that must have changed?  But I don't know when.
>>
> 
> 
> I think it was at some time in 21.3.50 from CVS, before stable GNU Emacs 
> 22 was released, September or October 2007.


But wasn't 22 released in June?

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: emacs keybinding syntaxes bewilderment
  2007-12-16 23:33               ` Lennart Borgman (gmail)
@ 2007-12-16 23:50                 ` Peter Dyballa
  0 siblings, 0 replies; 17+ messages in thread
From: Peter Dyballa @ 2007-12-16 23:50 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: help-gnu-emacs, Harald Hanche-Olsen


Am 17.12.2007 um 00:33 schrieb Lennart Borgman (gmail):

> Peter Dyballa wrote:
>> Am 16.12.2007 um 20:37 schrieb Harald Hanche-Olsen:
>>> Now it used to be, unless I am mistaken, that the elisp
>>> manual used not to be distributed with the emacs source code, but  
>>> came
>>> separately.  I guess that must have changed?  But I don't know when.
>>>
>> I think it was at some time in 21.3.50 from CVS, before stable GNU  
>> Emacs 22 was released, September or October 2007.
>
>
> But wasn't 22 released in June?

Then 22.1? I'm not using stable versions, so I am a bit uncertain. I  
remember that some real change happened then (22.1.50 -> 23.0.50?)  
and by paying more attention to the contents of the *compilation*  
buffer I found that the elisp.texi and elisp-* files appeared there.


OK, I found a hint a ChangeLog file:

	2007-09-06  Glenn Morris  <rgm>
	
		* Move from lispref/ to doc/lispref/.  Change all setfilename
		commands to use ../../info.
		* Makefile.in (infodir): Go up one more level.
		(usermanualdir): Change from ../man to ../emacs.
		(miscmanualdir): New.
		(dist): Use new variable miscmanualdir.
		* makefile.w32-in (infodir, texinputdir): Go up one more level.
		(usermanualdir): Change from ../man to ../emacs.
	
	[...]
	
	2007-08-29  Glenn Morris  <rgm>
	
		* elisp.texi (EMACSVER): Increase to 23.0.50.
	
Is this already Alzheimer? Then using a mobile phone wouldn't make  
more damage when becoming up-to-date myself ...

--
Greetings

   Pete

With Capitalism man exploits man. With communism it's the exact  
opposite.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: emacs keybinding syntaxes bewilderment
  2007-12-15 16:48 ` rustom
  2007-12-16  7:22   ` Mike Mattie
       [not found]   ` <mailman.5061.1197789814.18990.help-gnu-emacs@gnu.org>
@ 2007-12-17  9:38   ` Tassilo Horn
  2 siblings, 0 replies; 17+ messages in thread
From: Tassilo Horn @ 2007-12-17  9:38 UTC (permalink / raw)
  To: help-gnu-emacs

rustom <rustompmody@gmail.com> writes:

Hi!

> I am using emacs for the last 15 years but every time I try to do a
> define-key or global-set-key, I have to fish around in the info pages
> to get the key syntax right.

Ok, there are a lot of alternatives, but with `kbd' you're always on the
safe side.  Simply do `C-h k <key you want to bind>'.  That will show
you the right synctax for `kbd'.

Example: `C-h k C-c M-t' echoes

  C-c M-t is undefined

So you cold use

  (define-key foo-bar-map (kbd "C-c M-t") 'some-command)

Bye,
Tassilo

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: emacs keybinding syntaxes bewilderment
  2007-12-16 16:39         ` rustom
  2007-12-16 19:37           ` Harald Hanche-Olsen
@ 2007-12-17 10:17           ` Sebastian Tennant
       [not found]           ` <mailman.5091.1197886901.18990.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 17+ messages in thread
From: Sebastian Tennant @ 2007-12-17 10:17 UTC (permalink / raw)
  To: help-gnu-emacs

Quoth rustom <rustompmody@gmail.com>:
> On Dec 16, 1:56 pm, Harald Hanche-Olsen <han...@math.ntnu.no> wrote:
>> + rustom <rustompm...@gmail.com>:
>>
>> > But why is kbd not in the elisp manual?
>>
>> It isn't?  I found it via the index in mine.
>> Maybe you have an old version?
>
>
> My default emacs is 21. 22 is available as emacs-snapshot-gtk. So info
> emacs gives info for 21.  Could find no packages for info of 22 (that
> I could find). Strangely both 21 and 22 respond positively to describe-
> function kbd. Hence the mystery.
>
> I'm running debian etch.

Debian users need to install the package:

  emacs22-common-non-dfsg

The elisp manual is included in this package and I can confirm that kbd
is documented therein.

Sebastian

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: emacs keybinding syntaxes bewilderment
       [not found]           ` <mailman.5091.1197886901.18990.help-gnu-emacs@gnu.org>
@ 2007-12-17 12:56             ` Romain Francoise
  0 siblings, 0 replies; 17+ messages in thread
From: Romain Francoise @ 2007-12-17 12:56 UTC (permalink / raw)
  To: help-gnu-emacs

Sebastian Tennant <sebyte@smolny.plus.com> writes:

> Debian users need to install the package:

>   emacs22-common-non-dfsg

> The elisp manual is included in this package and I can confirm that kbd
> is documented therein.

This package is not available in etch, only in testing/unstable.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: emacs keybinding syntaxes bewilderment
  2007-12-14 22:24 emacs keybinding syntaxes bewilderment Xah Lee
  2007-12-14 23:15 ` B. T. Raven
  2007-12-15 16:48 ` rustom
@ 2007-12-18  6:12 ` Xah Lee
  2007-12-19  2:27 ` Xah
  3 siblings, 0 replies; 17+ messages in thread
From: Xah Lee @ 2007-12-18  6:12 UTC (permalink / raw)
  To: help-gnu-emacs

for those interested... just found this article

http://tiny-tools.sourceforge.net/emacs-keys.html
Author is “jaalto Exp”. Written in 2002.

It seems to be a comprehensive article on emacs keybindings. (far more
than i would cover)

From the site, i learned about this shortcut:

(global-set-key (kbd "M-i <up>") "↑")
instead of the usual
(global-set-key (kbd "M-i <up>") (lambda () (interactive) (insert
"↑")))

Neat!

i started few months ago to write a article explaining why are all
these variations but it's currently incomplete:
“The Confusion of Emacs's Keystroke Representation”
http://xahlee.org/emacs/keystroke_rep.html

  Xah
  xah@xahlee.org
\xAD\xF4 http://xahlee.org/

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: emacs keybinding syntaxes bewilderment
  2007-12-14 22:24 emacs keybinding syntaxes bewilderment Xah Lee
                   ` (2 preceding siblings ...)
  2007-12-18  6:12 ` Xah Lee
@ 2007-12-19  2:27 ` Xah
  3 siblings, 0 replies; 17+ messages in thread
From: Xah @ 2007-12-19  2:27 UTC (permalink / raw)
  To: help-gnu-emacs

When writing a keybinding code involving a function key, such as

Ctrl+F1, i've always used

(kbd "C-<f1>"), but i just realized that according to the printout
from describe-key, it seems that it should be “<C-f1>” instead. i.e.
when a named functional key is involved, it brings all the modifier
key inside the angle braket.

Is that suppose to be that way? seems less logical. Compare:

 a         M-a          C-M-a
 <up>      M-<up>        C-M-<up>
 <kb-1>    M-<kb-1>      C-M-<kb-1>

i don't see why all the modifier keys should be brought inside the
angle bracket that designate function keys.

  Xah
  xah@xahlee.org
\xAD\xF4 http://xahlee.org/

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2007-12-19  2:27 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-14 22:24 emacs keybinding syntaxes bewilderment Xah Lee
2007-12-14 23:15 ` B. T. Raven
2007-12-15  1:57   ` Xah Lee
2007-12-15 16:48 ` rustom
2007-12-16  7:22   ` Mike Mattie
     [not found]   ` <mailman.5061.1197789814.18990.help-gnu-emacs@gnu.org>
2007-12-16  8:25     ` rustom
2007-12-16  8:56       ` Harald Hanche-Olsen
2007-12-16 16:39         ` rustom
2007-12-16 19:37           ` Harald Hanche-Olsen
2007-12-16 23:21             ` Peter Dyballa
2007-12-16 23:33               ` Lennart Borgman (gmail)
2007-12-16 23:50                 ` Peter Dyballa
2007-12-17 10:17           ` Sebastian Tennant
     [not found]           ` <mailman.5091.1197886901.18990.help-gnu-emacs@gnu.org>
2007-12-17 12:56             ` Romain Francoise
2007-12-17  9:38   ` Tassilo Horn
2007-12-18  6:12 ` Xah Lee
2007-12-19  2:27 ` Xah

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).