* Key binding with multiple modifiers
@ 2004-01-26 21:18 Chris Laux
2004-01-26 21:19 ` Alan Mackenzie
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Chris Laux @ 2004-01-26 21:18 UTC (permalink / raw)
Hello,
What is the correct way to bind a key modified by both the control and
the meta key? I failed to find an example in the help texts and the
following command doesn't work:
(global-set-key "\C-M-7" 'shell)
When I try the following, the binding is listed when accessed with C-h
b, but actually pressing the keys just gets "C-M-7" printed in the
minibuffer:
(global-set-key [C-M-7] 'shell)
Any help would be greatly appreciated,
Chris
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Key binding with multiple modifiers
2004-01-26 21:18 Key binding with multiple modifiers Chris Laux
@ 2004-01-26 21:19 ` Alan Mackenzie
2004-01-27 11:11 ` Chris Laux
2004-01-26 21:26 ` Jesper Harder
2004-01-26 22:13 ` Stefan Monnier
2 siblings, 1 reply; 8+ messages in thread
From: Alan Mackenzie @ 2004-01-26 21:19 UTC (permalink / raw)
Chris Laux <Christopher.laux@web.de> wrote on 26 Jan 2004 13:18:43 -0800:
> Hello,
> What is the correct way to bind a key modified by both the control and
> the meta key? I failed to find an example in the help texts and the
> following command doesn't work:
Have a look at the info page "How do I bind a combination of modifier key
and function key?" under "Key Bindings" in the Emacs FAQ.
Another useful trick is to do the binding interactively with M-x
global-set-key, etc., then use C-x <esc> <esc> (`repeat-complex-command')
to see what it looks like in lisp.
> (global-set-key "\C-M-7" 'shell)
"\C-\M-7" is a correct syntax.
> When I try the following, the binding is listed when accessed with C-h
> b, but actually pressing the keys just gets "C-M-7" printed in the
> minibuffer:
> (global-set-key [C-M-7] 'shell)
At least your operating system seems to generate something sensible for
this key event.
> Any help would be greatly appreciated,
After typing the keys, do C-h l (`view-lossage') to check what Emacs
_really_ saw.
Try C-h c followed by C-M-7.
> Chris
--
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Key binding with multiple modifiers
2004-01-26 21:18 Key binding with multiple modifiers Chris Laux
2004-01-26 21:19 ` Alan Mackenzie
@ 2004-01-26 21:26 ` Jesper Harder
2004-01-26 22:13 ` Stefan Monnier
2 siblings, 0 replies; 8+ messages in thread
From: Jesper Harder @ 2004-01-26 21:26 UTC (permalink / raw)
Christopher.laux@Web.de (Chris Laux) writes:
> When I try the following, the binding is listed when accessed with
> C-h b, but actually pressing the keys just gets "C-M-7" printed in
> the minibuffer:
>
> (global-set-key [C-M-7] 'shell)
>
> Any help would be greatly appreciated,
Try
(global-set-key (kbd "C-M-7") 'shell)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Key binding with multiple modifiers
2004-01-26 21:18 Key binding with multiple modifiers Chris Laux
2004-01-26 21:19 ` Alan Mackenzie
2004-01-26 21:26 ` Jesper Harder
@ 2004-01-26 22:13 ` Stefan Monnier
2 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2004-01-26 22:13 UTC (permalink / raw)
> What is the correct way to bind a key modified by both the control and
> the meta key? I failed to find an example in the help texts and the
> following command doesn't work:
I recommend the [(control ?x) (control meta ?7)] syntax.
The kbd syntax is also good.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Key binding with multiple modifiers
2004-01-26 21:19 ` Alan Mackenzie
@ 2004-01-27 11:11 ` Chris Laux
2004-01-27 19:58 ` Kevin Rodgers
2004-01-28 18:53 ` Stefan Monnier
0 siblings, 2 replies; 8+ messages in thread
From: Chris Laux @ 2004-01-27 11:11 UTC (permalink / raw)
Alan Mackenzie<none@example.invalid> wrote in message
> Another useful trick is to do the binding interactively with M-x
> global-set-key, etc., then use C-x <esc> <esc> (`repeat-complex-command')
> to see what it looks like in lisp.
Thank you all for your help; the advice above actually worked in my
case, other examples didn't strangely. In case you are curious, I
ended up with the command looking like this:
;(global-set-key (quote [-67108809]) (quote shell))
Chris
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Key binding with multiple modifiers
2004-01-27 11:11 ` Chris Laux
@ 2004-01-27 19:58 ` Kevin Rodgers
2004-01-28 18:53 ` Stefan Monnier
1 sibling, 0 replies; 8+ messages in thread
From: Kevin Rodgers @ 2004-01-27 19:58 UTC (permalink / raw)
Chris Laux wrote:
> Alan Mackenzie<none@example.invalid> wrote in message
>
>
>>Another useful trick is to do the binding interactively with M-x
>>global-set-key, etc., then use C-x <esc> <esc> (`repeat-complex-command')
>>to see what it looks like in lisp.
>>
>
> Thank you all for your help; the advice above actually worked in my
> case, other examples didn't strangely. In case you are curious, I
> ended up with the command looking like this:
>
> ;(global-set-key (quote [-67108809]) (quote shell))
That is not portable, which is why the "\M-\C-x", [?\M-\C-x], and
(meta control ?x) syntaxes are preferred.
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Key binding with multiple modifiers
2004-01-27 11:11 ` Chris Laux
2004-01-27 19:58 ` Kevin Rodgers
@ 2004-01-28 18:53 ` Stefan Monnier
2004-01-31 20:17 ` Kai Grossjohann
1 sibling, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2004-01-28 18:53 UTC (permalink / raw)
> ;(global-set-key (quote [-67108809]) (quote shell))
Where did you get this from ?
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Key binding with multiple modifiers
2004-01-28 18:53 ` Stefan Monnier
@ 2004-01-31 20:17 ` Kai Grossjohann
0 siblings, 0 replies; 8+ messages in thread
From: Kai Grossjohann @ 2004-01-31 20:17 UTC (permalink / raw)
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> ;(global-set-key (quote [-67108809]) (quote shell))
>
> Where did you get this from ?
M-x global-set-key ...
C-x ESC ESC ...
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2004-01-31 20:17 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-26 21:18 Key binding with multiple modifiers Chris Laux
2004-01-26 21:19 ` Alan Mackenzie
2004-01-27 11:11 ` Chris Laux
2004-01-27 19:58 ` Kevin Rodgers
2004-01-28 18:53 ` Stefan Monnier
2004-01-31 20:17 ` Kai Grossjohann
2004-01-26 21:26 ` Jesper Harder
2004-01-26 22:13 ` Stefan Monnier
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).