* Binding C-i without losing <tab> functionality
@ 2008-10-24 0:56 Joseph Peterson
2008-10-24 8:35 ` Paul R
[not found] ` <mailman.1986.1224837322.25473.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 11+ messages in thread
From: Joseph Peterson @ 2008-10-24 0:56 UTC (permalink / raw)
To: help-gnu-emacs
Hello all,
I'm trying to bind C-i to isearch-forward, but I'm having some problems.
It doesn't change anything when I do this or variations of this:
(global-set-key [?\C-i] 'isearch-forward)
Sometimes it seems like it will work, but it rebinds the tab key, too
(I may be remembering when I bound TAB, though...)
If I bind both <tab> and C-i, then it seems that I can rebind C-i to be
different than <tab>. Like this:
(global-set-key [tab] 'c-indent-command)
(global-set-key [?\C-i] 'isearch-forward)
Then it seems to work, but then I lose all the mode-specific bindings.
(Most annoying is the loss of mini-buffer completion). How do I bind
C-i without affecting the Tab key?
Thanks all,
-JEEP
Joe Peterson
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Binding C-i without losing <tab> functionality
2008-10-24 0:56 Binding C-i without losing <tab> functionality Joseph Peterson
@ 2008-10-24 8:35 ` Paul R
[not found] ` <mailman.1986.1224837322.25473.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 11+ messages in thread
From: Paul R @ 2008-10-24 8:35 UTC (permalink / raw)
To: jeepeterson; +Cc: help-gnu-emacs
On Thu, 23 Oct 2008 17:56:03 -0700 (PDT), Joseph Peterson <jeepeterson@yahoo.com> said:
Joseph> Hello all, I'm trying to bind C-i to isearch-forward, but I'm
Joseph> having some problems.
Some devices are known to treat C-i and TAB as the same signal, as
well as C-m and RET. I think this is why it is not so easy to
dissociate them in emacs, even when your device allows it.
--
Paul
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Binding C-i without losing <tab> functionality
[not found] <mailman.1964.1224816146.25473.help-gnu-emacs@gnu.org>
@ 2008-10-24 8:44 ` Xah
0 siblings, 0 replies; 11+ messages in thread
From: Xah @ 2008-10-24 8:44 UTC (permalink / raw)
To: help-gnu-emacs
On Oct 23, 5:56 pm, Joseph Peterson <jeepeter...@yahoo.com> wrote:
> Hello all,
>
> I'm trying to bind C-i to isearch-forward, but I'm having some problems.
>
> It doesn't change anything when I do this or variations of this:
> (global-set-key [?\C-i] 'isearch-forward)
>
> Sometimes it seems like it will work, but it rebinds the tab key, too
> (I may be remembering when I bound TAB, though...)
>
> If I bind both <tab> and C-i, then it seems that I can rebind C-i to be
> different than <tab>. Like this:
> (global-set-key [tab] 'c-indent-command)
> (global-set-key [?\C-i] 'isearch-forward)
>
> Then it seems to work, but then I lose all the mode-specific bindings.
> (Most annoying is the loss of mini-buffer completion). How do I bind
> C-i without affecting the Tab key?
not sure if you can. Because i think internally Ctrl+i and Tab are
both rerpresented by ascii 9. (ascii 9 is named Horizontal Tab with
standard notation ^I)
similar other pairs i noticed are Return and Ctrl+m (which is ascii
13; ^M).
i might be wrong though.
Reference:
http://xahlee.org/elisp/Character-Type.html
quote: «
Control characters may be represented using yet another read syntax.
This consists of a question mark followed by a backslash, caret, and
the corresponding non-control character, in either upper or lower
case. For example, both `?\^I' and `?\^i' are valid read syntax for
the character C-i, the character whose value is 9.
Instead of the `^', you can use “C-”; thus, `?\C-i' is equivalent to `?
\^I' and to `?\^i':
?\^I ⇒ 9 ?\C-I ⇒ 9
»
Xah
∑ http://xahlee.org/
☄
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Binding C-i without losing <tab> functionality
[not found] ` <mailman.1986.1224837322.25473.help-gnu-emacs@gnu.org>
@ 2008-10-24 9:30 ` Andreas Politz
2008-10-24 15:40 ` jeep
2008-10-24 15:32 ` jeep
1 sibling, 1 reply; 11+ messages in thread
From: Andreas Politz @ 2008-10-24 9:30 UTC (permalink / raw)
To: help-gnu-emacs
Paul R wrote:
> On Thu, 23 Oct 2008 17:56:03 -0700 (PDT), Joseph Peterson <jeepeterson@yahoo.com> said:
>
> Joseph> Hello all, I'm trying to bind C-i to isearch-forward, but I'm
> Joseph> having some problems.
>
> Some devices are known to treat C-i and TAB as the same signal, as
> well as C-m and RET. I think this is why it is not so easy to
> dissociate them in emacs, even when your device allows it.
>
This looks like the answer :
,----[ (info "(elisp)Function Keys") ]
| In ASCII, `C-i' and <TAB> are the same character. If the terminal
| can distinguish between them, Emacs conveys the distinction to
| Lisp programs by representing the former as the integer 9, and the
| latter as the symbol `tab'.
|
| Most of the time, it's not useful to distinguish the two. So
| normally `function-key-map' (*note Translation Keymaps::) is set
| up to map `tab' into 9. Thus, a key binding for character code 9
| (the character `C-i') also applies to `tab'. Likewise for the
| other symbols in this group. The function `read-char' likewise
| converts these events into characters.
`----
(member '(tab . [9]) function-keymap)
-ap
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Binding C-i without losing <tab> functionality
[not found] ` <mailman.1986.1224837322.25473.help-gnu-emacs@gnu.org>
2008-10-24 9:30 ` Andreas Politz
@ 2008-10-24 15:32 ` jeep
1 sibling, 0 replies; 11+ messages in thread
From: jeep @ 2008-10-24 15:32 UTC (permalink / raw)
To: help-gnu-emacs
> Some devices are known to treat C-i and TAB as the same signal, as
> well as C-m and RET. I think this is why it is not so easy to
> dissociate them in emacs, even when your device allows it.
I can disassociate them... if I set them both. My understanding is
that
C-i and <tab> are both, by default, set to ASCII character 9, which is
given the notation TAB.
If I set both "C-i" and "<tab>", then C-i and the tab key do different
things.
Unfortunately, many modes bind the tab key differently. I want to keep
all those other bindings while reassigning C-i.
It's the same thing with <return> and C-m. They are both aliased to
RET (ASCII 13). But the following code works fine:
(global-set-key [return] 'newline)
(global-set-key [?\C-m] 'open-line)
I don't know how to make one different than the other without binding
them both. The <tab> is so useful, I don't want to globally rebind it.
I only want C-i rebound.
-JEEP
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Binding C-i without losing <tab> functionality
2008-10-24 9:30 ` Andreas Politz
@ 2008-10-24 15:40 ` jeep
2008-10-24 17:37 ` Andreas Politz
0 siblings, 1 reply; 11+ messages in thread
From: jeep @ 2008-10-24 15:40 UTC (permalink / raw)
To: help-gnu-emacs
On Oct 24, 2:30 am, Andreas Politz <poli...@fh-trier.de> wrote:
> (member '(tab . [9]) function-keymap)
Would you mind explaining this a little? I cannot evaluate that in
emacs. And I don't understand what it's supposed to do.
Thanks,
-JEEP
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Binding C-i without losing <tab> functionality
2008-10-24 15:40 ` jeep
@ 2008-10-24 17:37 ` Andreas Politz
2008-10-24 18:45 ` jeep
2008-10-25 5:13 ` jeep
0 siblings, 2 replies; 11+ messages in thread
From: Andreas Politz @ 2008-10-24 17:37 UTC (permalink / raw)
To: help-gnu-emacs
jeep wrote:
> On Oct 24, 2:30 am, Andreas Politz <poli...@fh-trier.de> wrote:
>> (member '(tab . [9]) function-keymap)
>
> Would you mind explaining this a little? I cannot evaluate that in
> emacs. And I don't understand what it's supposed to do.
>
> Thanks,
> -JEEP
I forgot a hyphen. The thing is called `function-key-map'.
(member '(tab . [9]) function-key-map)
After reading the mentioned info page (what you should have done as well)
, I would do it like so:
1. Don't translate tab into C-i.
(define-key function-key-map [tab] nil)
2. Swap the meanings of tab and C-i.
(define-key key-translation-map [9] [tab])
(define-key key-translation-map [tab] [9])
3. Bind tab (which is now actually C-i)
(global-set-key [tab] 'isearch-forward)
Note that I am an emacs newbie as well, so I can't tell what
sideeffects this has. But it seems to work. Unless the system
can't differentiate this 2 keys, like in an xterm.
-ap
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Binding C-i without losing <tab> functionality
2008-10-24 17:37 ` Andreas Politz
@ 2008-10-24 18:45 ` jeep
2008-10-25 5:13 ` jeep
1 sibling, 0 replies; 11+ messages in thread
From: jeep @ 2008-10-24 18:45 UTC (permalink / raw)
To: help-gnu-emacs
Thank you! That seems to work. I'll post again if I find any weird
side effects.
> After reading the mentioned info page (what you should have done as well)
In my defense, I did read the info page... I just didn't understand
it. *blush*
I should have mentioned that, I guess.
Thanks,
-JEEP
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Binding C-i without losing <tab> functionality
2008-10-24 17:37 ` Andreas Politz
2008-10-24 18:45 ` jeep
@ 2008-10-25 5:13 ` jeep
2008-10-25 10:02 ` Andreas Politz
1 sibling, 1 reply; 11+ messages in thread
From: jeep @ 2008-10-25 5:13 UTC (permalink / raw)
To: help-gnu-emacs
> 1. Don't translate tab into C-i.
> (define-key function-key-map [tab] nil)
> 2. Swap the meanings of tab and C-i.
> (define-key key-translation-map [9] [tab])
> (define-key key-translation-map [tab] [9])
> 3. Bind tab (which is now actually C-i)
> (global-set-key [tab] 'isearch-forward)
I really do appreciate the help and I'm sorry that I'm being a bit
dense, but I want to understand this.
This works for what I want to do, but I still don't grok it. I
understand all the steps, but now... if I want to reassign the tab
key, how would I go about doing that? Everything I try seems to fail,
just like it did before for C-i. I've been reading info for hours now
and I understand a lot more about emacs, but this still bothers me.
Thanks a lot.
-JEEP
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Binding C-i without losing <tab> functionality
2008-10-25 5:13 ` jeep
@ 2008-10-25 10:02 ` Andreas Politz
2008-10-29 5:29 ` jeep
0 siblings, 1 reply; 11+ messages in thread
From: Andreas Politz @ 2008-10-25 10:02 UTC (permalink / raw)
To: help-gnu-emacs
jeep wrote:
>> 1. Don't translate tab into C-i.
>> (define-key function-key-map [tab] nil)
>> 2. Swap the meanings of tab and C-i.
>> (define-key key-translation-map [9] [tab])
>> (define-key key-translation-map [tab] [9])
>> 3. Bind tab (which is now actually C-i)
>> (global-set-key [tab] 'isearch-forward)
>
> I really do appreciate the help and I'm sorry that I'm being a bit
> dense, but I want to understand this.
>
> This works for what I want to do, but I still don't grok it. I
> understand all the steps, but now... if I want to reassign the tab
> key, how would I go about doing that? Everything I try seems to fail,
> just like it did before for C-i. I've been reading info for hours now
> and I understand a lot more about emacs, but this still bothers me.
>
> Thanks a lot.
> -JEEP
What are you doing and what doesn't work ?
-ap
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Binding C-i without losing <tab> functionality
2008-10-25 10:02 ` Andreas Politz
@ 2008-10-29 5:29 ` jeep
0 siblings, 0 replies; 11+ messages in thread
From: jeep @ 2008-10-29 5:29 UTC (permalink / raw)
To: help-gnu-emacs
On Oct 25, 3:02 am, Andreas Politz <poli...@fh-trier.de> wrote:
> jeep wrote:
> >> 1. Don't translate tab into C-i.
> >> (define-key function-key-map [tab] nil)
> >> 2. Swap the meanings of tab and C-i.
> >> (define-key key-translation-map [9] [tab])
> >> (define-key key-translation-map [tab] [9])
> >> 3. Bind tab (which is now actually C-i)
> >> (global-set-key [tab] 'isearch-forward)
>
> > I really do appreciate the help and I'm sorry that I'm being a bit
> > dense, but I want to understand this.
>
> > This works for what I want to do, but I still don't grok it. I
> > understand all the steps, but now... if I want to reassign the tab
> > key, how would I go about doing that? Everything I try seems to fail,
> > just like it did before for C-i. I've been reading info for hours now
> > and I understand a lot more about emacs, but this still bothers me.
>
> > Thanks a lot.
> > -JEEP
>
> What are you doing and what doesn't work ?
>
> -ap
Sorry, I don't recall what I was doing wrong, but I managed to figure
it out. I guess I just needed a day to let things soak in.
Thanks!
-JEEP
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2008-10-29 5:29 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-24 0:56 Binding C-i without losing <tab> functionality Joseph Peterson
2008-10-24 8:35 ` Paul R
[not found] ` <mailman.1986.1224837322.25473.help-gnu-emacs@gnu.org>
2008-10-24 9:30 ` Andreas Politz
2008-10-24 15:40 ` jeep
2008-10-24 17:37 ` Andreas Politz
2008-10-24 18:45 ` jeep
2008-10-25 5:13 ` jeep
2008-10-25 10:02 ` Andreas Politz
2008-10-29 5:29 ` jeep
2008-10-24 15:32 ` jeep
[not found] <mailman.1964.1224816146.25473.help-gnu-emacs@gnu.org>
2008-10-24 8:44 ` Xah
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.