* Help with setting a key (C-<right> moving a full word to the right)
@ 2013-06-07 3:20 Max Rubin
2013-06-07 7:06 ` Eli Zaretskii
2013-06-07 7:26 ` Jambunathan K
0 siblings, 2 replies; 12+ messages in thread
From: Max Rubin @ 2013-06-07 3:20 UTC (permalink / raw)
To: help-gnu-emacs
Hey there helpful listservers!
I only discovered today that you can edit your .emacs file and add in
custom keys and change the settings, and I've unfortunately run into a
problem. I want ctrl+right arrow to move forward one whole word at a time,
and ctrl+left arrow to move back a whole word at a time. The keys M-f and
M-b already do this using 'forward-word and 'backward-word, but I cannot
figure out how represent C+<right/left arrow>. I've tried "
(global-set-key (kbd "C-<right>") 'forward-word " but that doesn't work.
In fact, no key name that exists in angle brackets (<f1>, <f9>, <home>,
<end>) work. If I changed it to " (global-set-key (kbd "C-l")
'forward-word ", then it works as expected, so my computer is definitely
not comprehending the angle bracket keys.
Anyone know what is wrong and how to fix it?
Thank you,
Max
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Help with setting a key (C-<right> moving a full word to the right)
2013-06-07 3:20 Max Rubin
@ 2013-06-07 7:06 ` Eli Zaretskii
2013-06-07 7:26 ` Jambunathan K
1 sibling, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2013-06-07 7:06 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Thu, 6 Jun 2013 23:20:26 -0400
> From: Max Rubin <merubin@princeton.edu>
>
> I only discovered today that you can edit your .emacs file and add in
> custom keys and change the settings, and I've unfortunately run into a
> problem. I want ctrl+right arrow to move forward one whole word at a time,
> and ctrl+left arrow to move back a whole word at a time. The keys M-f and
> M-b already do this using 'forward-word and 'backward-word, but I cannot
> figure out how represent C+<right/left arrow>. I've tried "
> (global-set-key (kbd "C-<right>") 'forward-word " but that doesn't work.
> In fact, no key name that exists in angle brackets (<f1>, <f9>, <home>,
> <end>) work. If I changed it to " (global-set-key (kbd "C-l")
> 'forward-word ", then it works as expected, so my computer is definitely
> not comprehending the angle bracket keys.
>
> Anyone know what is wrong and how to fix it?
This works by default, so I'm unsure why would you need to do anything
to have C-<right> and C-<left> move by words.
What version of Emacs is that, an on what OS? Is this a GUI session
or a text-terminal session?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Help with setting a key (C-<right> moving a full word to the right)
2013-06-07 3:20 Max Rubin
2013-06-07 7:06 ` Eli Zaretskii
@ 2013-06-07 7:26 ` Jambunathan K
2013-06-28 16:00 ` Max Rubin
1 sibling, 1 reply; 12+ messages in thread
From: Jambunathan K @ 2013-06-07 7:26 UTC (permalink / raw)
To: Max Rubin; +Cc: help-gnu-emacs
Do
M-x global-set-key RET
and do whatever Emacs asks you to do. Once that is done do,
M-x list-command-history RET
and you will some thing like this:
(global-set-key [C-right] (quote forward-word))
Copy that to your .emacs. You are done.
Max Rubin <merubin@princeton.edu> writes:
> Hey there helpful listservers!
>
> I only discovered today that you can edit your .emacs file and add in
> custom keys and change the settings, and I've unfortunately run into a
> problem. I want ctrl+right arrow to move forward one whole word at a time,
> and ctrl+left arrow to move back a whole word at a time. The keys M-f and
> M-b already do this using 'forward-word and 'backward-word, but I cannot
> figure out how represent C+<right/left arrow>. I've tried "
> (global-set-key (kbd "C-<right>") 'forward-word " but that doesn't work.
> In fact, no key name that exists in angle brackets (<f1>, <f9>, <home>,
> <end>) work. If I changed it to " (global-set-key (kbd "C-l")
> 'forward-word ", then it works as expected, so my computer is definitely
> not comprehending the angle bracket keys.
>
> Anyone know what is wrong and how to fix it?
>
> Thank you,
> Max
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Help with setting a key (C-<right> moving a full word to the right)
[not found] <mailman.1133.1370587085.22516.help-gnu-emacs@gnu.org>
@ 2013-06-07 19:06 ` Emanuel Berg
2013-06-07 20:00 ` Eli Zaretskii
[not found] ` <mailman.1189.1370635224.22516.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 12+ messages in thread
From: Emanuel Berg @ 2013-06-07 19:06 UTC (permalink / raw)
To: help-gnu-emacs
Max Rubin <merubin@princeton.edu> writes:
> I want ctrl+right arrow to move forward one whole word at a
> time, and ctrl+left arrow to move back a whole word at a time.
> The keys M-f and M-b already do this using 'forward-word and
> 'backward-word
M-f and M-b are much better shortcuts for this. That way you don't
have to move you right hand from the typing area of the
keyboard. All the cursor movement shortcuts are placed there, and
for good reason: C-a, C-e (start or end of line); C-f, C-b (move
forward or backward by char); M-d, M-DEL (kill word forward or
backward); C-t to "transpose", i.e., to fix the common typo of
incorrect char order; etc.
You are able to move the cursor wherever you like it, kill, yank,
whatever you like to do, but at the instant you are done and wish
to resume typing, both your hands are still in the correct
position.
Jambunathan K <kjambunathan@gmail.com> writes:
> (global-set-key [C-right] (quote forward-word))
That doesn't work for me. When I press C-right, only <right> is
reported. I'm using GNU Emacs 23.4.1 in a Linux VT.
--
Emanuel Berg - programmer (hire me! CV below)
computer projects: http://user.it.uu.se/~embe8573
internet activity: http://home.student.uu.se/embe8573
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Help with setting a key (C-<right> moving a full word to the right)
2013-06-07 19:06 ` Help with setting a key (C-<right> moving a full word to the right) Emanuel Berg
@ 2013-06-07 20:00 ` Eli Zaretskii
[not found] ` <mailman.1189.1370635224.22516.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2013-06-07 20:00 UTC (permalink / raw)
To: help-gnu-emacs
> From: Emanuel Berg <embe8573@student.uu.se>
> Date: Fri, 07 Jun 2013 21:06:34 +0200
>
> > (global-set-key [C-right] (quote forward-word))
>
> That doesn't work for me. When I press C-right, only <right> is
> reported. I'm using GNU Emacs 23.4.1 in a Linux VT.
I don't know what is a "Linux VT", but I suspect that it's a text-mode
terminal. In which case Emacs simply doesn't get reported that
C-right was pressed. Try "C-h l" (that's the letter ell, not the
digit one), and see if Emacs at all sees the Ctrl modifier. It
doesn't in most text terminals.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Help with setting a key (C-<right> moving a full word to the right)
[not found] ` <mailman.1189.1370635224.22516.help-gnu-emacs@gnu.org>
@ 2013-06-07 20:37 ` Emanuel Berg
2013-06-08 3:31 ` Eli Zaretskii
[not found] ` <mailman.1201.1370662319.22516.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 12+ messages in thread
From: Emanuel Berg @ 2013-06-07 20:37 UTC (permalink / raw)
To: help-gnu-emacs
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Emanuel Berg <embe8573@student.uu.se>
>> Date: Fri, 07 Jun 2013 21:06:34 +0200
>>
>> > (global-set-key [C-right] (quote forward-word))
>>
>> That doesn't work for me. When I press C-right, only <right> is
>> reported. I'm using GNU Emacs 23.4.1 in a Linux VT.
>
> I don't know what is a "Linux VT", but I suspect that it's a
> text-mode terminal. In which case Emacs simply doesn't get
> reported that C-right was pressed. Try "C-h l" (that's the
> letter ell, not the digit one), and see if Emacs at all sees the
> Ctrl modifier.
It doesn't, like I said :)
Linux VTs = those tty's, "the console", that appear on (the
default) shortcuts Ctrl-Alt-F1 (up to F5).
--
Emanuel Berg - programmer (hire me! CV below)
computer projects: http://user.it.uu.se/~embe8573
internet activity: http://home.student.uu.se/embe8573
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Help with setting a key (C-<right> moving a full word to the right)
2013-06-07 20:37 ` Emanuel Berg
@ 2013-06-08 3:31 ` Eli Zaretskii
[not found] ` <mailman.1201.1370662319.22516.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2013-06-08 3:31 UTC (permalink / raw)
To: help-gnu-emacs
> From: Emanuel Berg <embe8573@student.uu.se>
> Date: Fri, 07 Jun 2013 22:37:33 +0200
>
> > I don't know what is a "Linux VT", but I suspect that it's a
> > text-mode terminal. In which case Emacs simply doesn't get
> > reported that C-right was pressed. Try "C-h l" (that's the
> > letter ell, not the digit one), and see if Emacs at all sees the
> > Ctrl modifier.
>
> It doesn't, like I said :)
If Emacs doesn't see the Ctrl-right key, then the solution to this, if
any, is not on the Emacs level.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Help with setting a key (C-<right> moving a full word to the right)
[not found] ` <mailman.1201.1370662319.22516.help-gnu-emacs@gnu.org>
@ 2013-06-08 16:28 ` Emanuel Berg
2013-06-09 0:46 ` Bruno Félix Rezende Ribeiro
[not found] ` <mailman.1253.1370740031.22516.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 12+ messages in thread
From: Emanuel Berg @ 2013-06-08 16:28 UTC (permalink / raw)
To: help-gnu-emacs
Eli Zaretskii <eliz@gnu.org> writes:
>>> I don't know what is a "Linux VT", but I suspect that it's a
>>> text-mode terminal. In which case Emacs simply doesn't get
>>> reported that C-right was pressed. Try "C-h l" (that's the
>>> letter ell, not the digit one), and see if Emacs at all sees
>>> the Ctrl modifier.
>>
>> It doesn't, like I said :)
>
> If Emacs doesn't see the Ctrl-right key, then the solution to
> this, if any, is not on the Emacs level.
Correct. There was a guy who taught me a method, with which I setup
the backtab in Emacs (which was also unnoticed at first). If he is
reading this, perhaps he can tell us more. Anyway, I applied the
exact same procedure:
ctrll keycode 106 = U+010F # 106 = right arrow according to `showkey'
# Unicode code just a handle
Put that in a file, and load with
lkeys () {
sudo loadkeys -c -s /etc/console-setup/remap.inc > /dev/null
}
Then, in ~/.emacs, put
(define-key input-decode-map [?\u010F] [ctrlright])
(global-set-key (kbd "<ctrlright>") 'forward-word)
But it still doesn't work. Only, if I change the "ctrll" above for
shift, it works (but then for shift, of course). So in general,
the procedure works, if that is any consolation.
Also, note that I'm not the OP, I don't want this myself; and I
don't know if this issue is why he cannot get it
work. Nonetheless, it could be interesting to me to know, although
I'm not implementing it for this particular purpose.
--
Emanuel Berg - programmer (hire me! CV below)
computer projects: http://user.it.uu.se/~embe8573
internet activity: http://home.student.uu.se/embe8573
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Help with setting a key (C-<right> moving a full word to the right)
2013-06-08 16:28 ` Emanuel Berg
@ 2013-06-09 0:46 ` Bruno Félix Rezende Ribeiro
[not found] ` <mailman.1253.1370740031.22516.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 12+ messages in thread
From: Bruno Félix Rezende Ribeiro @ 2013-06-09 0:46 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1706 bytes --]
Emanuel Berg <embe8573@student.uu.se> writes:
> Eli Zaretskii <eliz@gnu.org> writes:
>
>>>> I don't know what is a "Linux VT", but I suspect that it's a
>>>> text-mode terminal. In which case Emacs simply doesn't get
>>>> reported that C-right was pressed. Try "C-h l" (that's the
>>>> letter ell, not the digit one), and see if Emacs at all sees
>>>> the Ctrl modifier.
>>>
>>> It doesn't, like I said :)
>>
>> If Emacs doesn't see the Ctrl-right key, then the solution to
>> this, if any, is not on the Emacs level.
>
> Correct. There was a guy who taught me a method, with which I setup
> the backtab in Emacs (which was also unnoticed at first). If he is
> reading this, perhaps he can tell us more.
Here I made it work. My kernel keymap snippet:
----- kernel keymap begin -----
control keycode 105 = U+0117 # <C-left>
control keycode 106 = U+0118 # <C-right>
control keycode 103 = U+0119 # <C-up>
control keycode 108 = U+011A # <C-down>
----- kernel keymap end -----
My emacs keymap snippet:
----- emacs keymap begin -----
(define-key input-decode-map [?\u0117] [C-left])
(define-key input-decode-map [?\u0118] [C-right])
(define-key input-decode-map [?\u0119] [C-up])
(define-key input-decode-map [?\u011A] [C-down])
----- emacs keymap end -----
Notice that it is not necessary to explicit bind each emacs
control-arrow sequence to the respective motion function because it is
already done by default.
Hope it helps.
--
,= ,-_-. =. Bruno Félix Rezende Ribeiro (oitofelix) [0x28D618AF]
((_/)o o(\_)) There is no system but GNU;
`-'(. .)`-' Linux-libre is just one of its kernels;
\_/ All software should be free as in freedom;
[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Help with setting a key (C-<right> moving a full word to the right)
[not found] ` <mailman.1253.1370740031.22516.help-gnu-emacs@gnu.org>
@ 2013-06-09 1:29 ` Emanuel Berg
0 siblings, 0 replies; 12+ messages in thread
From: Emanuel Berg @ 2013-06-09 1:29 UTC (permalink / raw)
To: help-gnu-emacs
oitofelix@riseup.net (Bruno Félix Rezende Ribeiro) writes:
>>>>> I don't know what is a "Linux VT", but I suspect that it's a
>>>>> text-mode terminal. In which case Emacs simply doesn't get
>>>>> reported that C-right was pressed. Try "C-h l" (that's the
>>>>> letter ell, not the digit one), and see if Emacs at all sees
>>>>> the Ctrl modifier.
>>>>
>>>> It doesn't, like I said :)
>>>
>>> If Emacs doesn't see the Ctrl-right key, then the solution to
>>> this, if any, is not on the Emacs level.
>>
>> Correct. There was a guy who taught me a method, with which I
>> setup the backtab in Emacs (which was also unnoticed at
>> first). If he is reading this, perhaps he can tell us more.
>
> Here I made it work. My kernel keymap snippet:
>
> ...
> control keycode 106 = U+0118 # <C-right>
That's interesting, because what I did was identical, only instead
of "control", I had "ctrll".
I assumed that ctrll is the left control key, but, if it is, for
some reason it doesn't work.
Also, ctrll has something to do with CAPS LOCK because I have this
## cycling tty's
# J
alt keycode 36 = Decr_Console
ctrll alt keycode 36 = Decr_Console
# K
alt keycode 37 = Incr_Console
ctrll alt keycode 37 = Incr_Console
and without those ctrll lines, it doesn't work when CAPS LOCK is on.
--
Emanuel Berg - programmer (hire me! CV below)
computer projects: http://user.it.uu.se/~embe8573
internet activity: http://home.student.uu.se/embe8573
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Help with setting a key (C-<right> moving a full word to the right)
2013-06-07 7:26 ` Jambunathan K
@ 2013-06-28 16:00 ` Max Rubin
2013-06-28 16:38 ` Peter Dyballa
0 siblings, 1 reply; 12+ messages in thread
From: Max Rubin @ 2013-06-28 16:00 UTC (permalink / raw)
To: Jambunathan K; +Cc: help-gnu-emacs
Hmmm, strangely enough my emacs still will not let me combine control with
the different named keys. After M-x global-set-key, it asks "set key
globally" and if I hold ctrl and hit right or left, it only says to set
<right> or <left>. This is the same with every other named key and Ctrl.
Could this problem be arising because my emacs version is 21?
Anyways I've circumvented the problem by setting M-<arrow keys> to the
functionality I desired. Thank you for the help, learning and customizing
emacs has been a lot of fun.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Help with setting a key (C-<right> moving a full word to the right)
2013-06-28 16:00 ` Max Rubin
@ 2013-06-28 16:38 ` Peter Dyballa
0 siblings, 0 replies; 12+ messages in thread
From: Peter Dyballa @ 2013-06-28 16:38 UTC (permalink / raw)
To: Max Rubin; +Cc: help-gnu-emacs help
Am 28.06.2013 um 18:00 schrieb Max Rubin:
> Could this problem be arising because my emacs version is 21?
Or is due to using it as a slave in some dumb terminal emulation? Let it use the windowing system and it will allow to set up a plethora of personal key bindings! (Upgrading to GNU Emacs 24.3 is a good idea, too.)
--
Greetings
Pete
To most people solutions mean finding the answers. But to chemists solutions
are things that are still all mixed up.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2013-06-28 16:38 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.1133.1370587085.22516.help-gnu-emacs@gnu.org>
2013-06-07 19:06 ` Help with setting a key (C-<right> moving a full word to the right) Emanuel Berg
2013-06-07 20:00 ` Eli Zaretskii
[not found] ` <mailman.1189.1370635224.22516.help-gnu-emacs@gnu.org>
2013-06-07 20:37 ` Emanuel Berg
2013-06-08 3:31 ` Eli Zaretskii
[not found] ` <mailman.1201.1370662319.22516.help-gnu-emacs@gnu.org>
2013-06-08 16:28 ` Emanuel Berg
2013-06-09 0:46 ` Bruno Félix Rezende Ribeiro
[not found] ` <mailman.1253.1370740031.22516.help-gnu-emacs@gnu.org>
2013-06-09 1:29 ` Emanuel Berg
2013-06-07 3:20 Max Rubin
2013-06-07 7:06 ` Eli Zaretskii
2013-06-07 7:26 ` Jambunathan K
2013-06-28 16:00 ` Max Rubin
2013-06-28 16:38 ` Peter Dyballa
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).