* Binding meta and arrow
@ 2005-05-13 23:27 Ian Crowther
2005-05-14 7:13 ` Eli Zaretskii
2005-05-14 15:56 ` Peter Dyballa
0 siblings, 2 replies; 9+ messages in thread
From: Ian Crowther @ 2005-05-13 23:27 UTC (permalink / raw)
I'm trying to make emacs bind "M-arrow" to things.
I know other applications can use the key combination in the same
environment (on the console, using putty and screen) and it seems emacs
itself can handle it; when I go "C-h c M-left" it says "ESC <left> is
undefined"
I can evaluate "(global-set-key [left] "left was pressed")" and get "left
was pressed" inserted into the buffer when I press left. All I now need to
do is try to figure out how to use the alt key on my keyboard.
I've tried the following:
(global-set-key [M-left] "M-left was pressed")
(global-set-key [A-left] "A-left was pressed")
(global-set-key [alt left] "alt left was pressed")
(global-set-key [meta left] "meta left was pressed")
And because I don't know what they do, I tried the following combinations
also:
(global-set-key [H-left] "H-left was pressed")
(global-set-key [s-left] "s-left was pressed")
None of them work. I know emacs can tell I've pressed M-left though. I'd be
grateful if somebody could tell me how I'm going wrong trying to bind it.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Binding meta and arrow
2005-05-13 23:27 Binding meta and arrow Ian Crowther
@ 2005-05-14 7:13 ` Eli Zaretskii
2005-05-14 15:56 ` Peter Dyballa
1 sibling, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2005-05-14 7:13 UTC (permalink / raw)
> From: "Ian Crowther" <i_crowther@hotmail.com>
> Bcc:
> Date: Sat, 14 May 2005 00:27:27 +0100
>
> I can evaluate "(global-set-key [left] "left was pressed")" and get "left
> was pressed" inserted into the buffer when I press left. All I now need to
> do is try to figure out how to use the alt key on my keyboard.
> I've tried the following:
> (global-set-key [M-left] "M-left was pressed")
> (global-set-key [A-left] "A-left was pressed")
> (global-set-key [alt left] "alt left was pressed")
> (global-set-key [meta left] "meta left was pressed")
>
> And because I don't know what they do, I tried the following combinations
> also:
> (global-set-key [H-left] "H-left was pressed")
> (global-set-key [s-left] "s-left was pressed")
>
>
> None of them work. I know emacs can tell I've pressed M-left though. I'd be
> grateful if somebody could tell me how I'm going wrong trying to bind it.
Just use a name of a function instead of the string. For example:
(global-set-key [M-left] 'beginning-of-line)
(The way you used global-set-key is meant for macros: the thing inside
quotes should be a sequence of one or more keys, it cannot be an
arbitrary string, and it certainly isn't displayed in the echo area,
it's fed back to the Emacs keyboard input.)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Binding meta and arrow
2005-05-13 23:27 Binding meta and arrow Ian Crowther
2005-05-14 7:13 ` Eli Zaretskii
@ 2005-05-14 15:56 ` Peter Dyballa
2005-05-14 23:51 ` Ian Crowther
1 sibling, 1 reply; 9+ messages in thread
From: Peter Dyballa @ 2005-05-14 15:56 UTC (permalink / raw)
Cc: help-gnu-emacs
Am 14.05.2005 um 01:27 schrieb Ian Crowther:
> And because I don't know what they do, I tried the following
> combinations also:
> (global-set-key [H-left] "H-left was pressed")
> (global-set-key [s-left] "s-left was pressed")
>
For these to work you need to have the Hyper and super modifiers
defined -- and those extra keys too!
--
Greetings
Pete
A lot of us are working harder than we want, at things we don't like to
do. Why? ...In order to afford the sort of existence we don't care to
live.
-- Bradford Angier
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Binding meta and arrow
2005-05-14 15:56 ` Peter Dyballa
@ 2005-05-14 23:51 ` Ian Crowther
2005-05-15 9:32 ` Peter Dyballa
0 siblings, 1 reply; 9+ messages in thread
From: Ian Crowther @ 2005-05-14 23:51 UTC (permalink / raw)
Cc: help-gnu-emacs
>Just use a name of a function instead of the string. For example:
> (global-set-key [M-left] 'beginning-of-line)
>(The way you used global-set-key is meant for macros: the thing inside
>quotes should be a sequence of one or more keys, it cannot be an
>arbitrary string, and it certainly isn't displayed in the echo area,
>it's fed back to the Emacs keyboard input.)
Well thanks, but I have exactly the same problem. If I do:
(global-set-key [left] 'beginning-of-line)
it does exactly what I expect. I press left and it goes to the line start.
The following still don't work:
(global-set-key [M-left] 'beginning-of-line)
(global-set-key [A-left] 'beginning-of-line)
(global-set-key [alt left] 'beginning-of-line)
(global-set-key [meta left] 'beginning-of-line)
After evaluating all of them I still get "ESC <left> is undefined" if I do
"C-h c M-left".
Thanks for correcting my fumbled attempt at lisp, but I'm still stuck.
Anybody got any other ideas?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Binding meta and arrow
2005-05-14 23:51 ` Ian Crowther
@ 2005-05-15 9:32 ` Peter Dyballa
2005-05-16 1:01 ` Ian Crowther
0 siblings, 1 reply; 9+ messages in thread
From: Peter Dyballa @ 2005-05-15 9:32 UTC (permalink / raw)
Cc: help-gnu-emacs
Am 15.05.2005 um 01:51 schrieb Ian Crowther:
> it does exactly what I expect. I press left and it goes to the line
> start. The following still don't work:
>
> (global-set-key [M-left] 'beginning-of-line)
> (global-set-key [A-left] 'beginning-of-line)
>
Try first 'M-x global-set-key <your keys> global-set-key' and then do
M-x repeat-complex-command. You now see the code for binding the key,
C-a and C-k and C-g and you insert it into your .emacs file. Could be
that either your X server or you keyboard do not support Alt and Meta
cursor keys. Are you working on a portable? What happens when you press
the fn key?
(global-set-key [(alt v)] 'yank) works for me. Could be you need to
change some of your syntax.
--
Greetings
Pete
Mac OS X is like a wigwam: no fences, no gates, but an apache inside.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Binding meta and arrow
2005-05-15 9:32 ` Peter Dyballa
@ 2005-05-16 1:01 ` Ian Crowther
2005-05-16 8:50 ` Peter Dyballa
0 siblings, 1 reply; 9+ messages in thread
From: Ian Crowther @ 2005-05-16 1:01 UTC (permalink / raw)
Cc: help-gnu-emacs
>Try first 'M-x global-set-key <your keys> global-set-key' and then do M-x
>repeat-complex-command.
Thanks! I have managed to get the key bound. That had been annoying me for
ages.
In case anybody else has the same problem, it was:
(global-set-key (quote [27 left]) 'beginning-of-line)
I cannot bind [(alt v)], yet I can bind [(meta v)], which makes sense since
it says "Alt .... available only under X" at
http://www.cs.uu.nl/wais/html/na-dir/GNU-Emacs-FAQ/part4.html
I'd love to know why meta didn't work with arrow keys though.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Binding meta and arrow
2005-05-16 1:01 ` Ian Crowther
@ 2005-05-16 8:50 ` Peter Dyballa
0 siblings, 0 replies; 9+ messages in thread
From: Peter Dyballa @ 2005-05-16 8:50 UTC (permalink / raw)
Cc: help-gnu-emacs
Am 16.05.2005 um 03:01 schrieb Ian Crowther:
> I cannot bind [(alt v)]
I think this works when you change the cmd and option keys. Then
alt/option does not select from the keyboard another layer of
characters but works as the Meta key. Cmd is then the alt modifier.
(setq mac-command-key-is-meta nil)
--
Greetings
Pete
"Only two things are infinite, the universe and human stupidity, and
I'm not
sure about the former" - Albert Einstein
^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <mailman.5162.1116027341.2819.help-gnu-emacs@gnu.org>]
* Re: Binding meta and arrow
[not found] <mailman.5162.1116027341.2819.help-gnu-emacs@gnu.org>
@ 2005-05-16 15:49 ` Stefan Monnier
2005-05-18 13:56 ` Ehud Karni
0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2005-05-16 15:49 UTC (permalink / raw)
> I'm trying to make emacs bind "M-arrow" to things.
> I know other applications can use the key combination in the same
> environment (on the console, using putty and screen) and it seems emacs
> itself can handle it; when I go "C-h c M-left" it says "ESC <left> is
> undefined"
Although "ESC a" is equivalent to "M-a", this is not true of function keys
like "left" where "M-left" is not the same as "ESC left".
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Binding meta and arrow
2005-05-16 15:49 ` Stefan Monnier
@ 2005-05-18 13:56 ` Ehud Karni
0 siblings, 0 replies; 9+ messages in thread
From: Ehud Karni @ 2005-05-18 13:56 UTC (permalink / raw)
Cc: help-gnu-emacs
On Mon, 16 May 2005 11:49:52 -0400, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>
> Although "ESC a" is equivalent to "M-a", this is not true of function keys
> like "left" where "M-left" is not the same as "ESC left".
That is true only if you don't set `meta-prefix-char' to another value.
I set it to nil and then "M-<char>" is NOT "ESC <char>" (and not a
combination of any key + <char>).
Ehud.
--
Ehud Karni Tel: +972-3-7966-561 /"\
Mivtach - Simon Fax: +972-3-7966-667 \ / ASCII Ribbon Campaign
Insurance agencies (USA) voice mail and X Against HTML Mail
http://www.mvs.co.il FAX: 1-815-5509341 / \
GnuPG: 98EA398D <http://www.keyserver.net/> Better Safe Than Sorry
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2005-05-18 13:56 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-13 23:27 Binding meta and arrow Ian Crowther
2005-05-14 7:13 ` Eli Zaretskii
2005-05-14 15:56 ` Peter Dyballa
2005-05-14 23:51 ` Ian Crowther
2005-05-15 9:32 ` Peter Dyballa
2005-05-16 1:01 ` Ian Crowther
2005-05-16 8:50 ` Peter Dyballa
[not found] <mailman.5162.1116027341.2819.help-gnu-emacs@gnu.org>
2005-05-16 15:49 ` Stefan Monnier
2005-05-18 13:56 ` Ehud Karni
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).