unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Separate bindings for the keyboard shortcuts Ctrl-i and TAB.
@ 2007-09-17  8:49 Nordlöw
  2007-09-17 11:16 ` Peter Dyballa
       [not found] ` <mailman.942.1190027818.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Nordlöw @ 2007-09-17  8:49 UTC (permalink / raw)
  To: help-gnu-emacs

How can I make Emacs distinguish the key binding Ctrl-i from TAB (plus
and modifiers)? The reason is that I want Ctrl-i to indent as usual
and TAB to do completion (hippie-expand) instead.

Thanks,
Nordlöw

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

* Re: Separate bindings for the keyboard shortcuts Ctrl-i and TAB.
  2007-09-17  8:49 Separate bindings for the keyboard shortcuts Ctrl-i and TAB Nordlöw
@ 2007-09-17 11:16 ` Peter Dyballa
       [not found] ` <mailman.942.1190027818.18990.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Peter Dyballa @ 2007-09-17 11:16 UTC (permalink / raw)
  To: Nordlöw; +Cc: help-gnu-emacs


Am 17.09.2007 um 10:49 schrieb Nordlöw:

> The reason is that I want Ctrl-i to indent as usual
> and TAB to do completion (hippie-expand) instead.

By law (ASCII, ISO 8859, Unicode, and proprietary standards) both are  
the same.

In X11 you can map whatever to the TAB key.

--
Greetings

   Pete

There is no worse tyranny than to force a man to pay for what he does  
not want merely because you think it would be good for him.
                                            -- Robert Heinlein

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

* Re: Separate bindings for the keyboard shortcuts Ctrl-i and TAB.
       [not found] ` <mailman.942.1190027818.18990.help-gnu-emacs@gnu.org>
@ 2007-09-17 13:25   ` Harald Hanche-Olsen
  2007-09-20 18:23     ` Johan Bockgård
  0 siblings, 1 reply; 5+ messages in thread
From: Harald Hanche-Olsen @ 2007-09-17 13:25 UTC (permalink / raw)
  To: help-gnu-emacs

+ Peter Dyballa <Peter_Dyballa@Web.DE>:

> Am 17.09.2007 um 10:49 schrieb Nordlöw:
>
>> The reason is that I want Ctrl-i to indent as usual
>> and TAB to do completion (hippie-expand) instead.
>
> By law (ASCII, ISO 8859, Unicode, and proprietary standards) both are
> the same.
>
> In X11 you can map whatever to the TAB key.

In X11 the <tab> key is, by default, mapped to the TAB character
(ASCII 9).  This is done in function-key-map, so to map <tab> and C-i
to different keys, the sensible ting would be to remove the <tab>
translation from function-key-map, then rebind it to whatever you
wish.  Note, however, that since function-key-map is a global map,
applied before any other key processing, this will have side effects
in /every/ mode, not just where you wanted separate definitions.  You
could circumvent this in various hackish ways, I suppose, like binding
<tab> in the global keymap to a function that looks up C-i in the
current keymaps and executes the result.  But I don't know enough
about event handling in emacs to tell you what the gotchas of such an
approach might be.  Maybe you could bind <tab> to a macro that runs
C-i?  Might be worth a try.

-- 
* 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] 5+ messages in thread

* Re: Separate bindings for the keyboard shortcuts Ctrl-i and TAB.
  2007-09-17 13:25   ` Harald Hanche-Olsen
@ 2007-09-20 18:23     ` Johan Bockgård
  2007-09-20 19:37       ` Harald Hanche-Olsen
  0 siblings, 1 reply; 5+ messages in thread
From: Johan Bockgård @ 2007-09-20 18:23 UTC (permalink / raw)
  To: help-gnu-emacs

Harald Hanche-Olsen <hanche@math.ntnu.no> writes:

> In X11 the <tab> key is, by default, mapped to the TAB character
> (ASCII 9).  This is done in function-key-map, so to map <tab> and C-i
> to different keys, the sensible ting would be to remove the <tab>
> translation from function-key-map, then rebind it to whatever you
> wish.  Note, however, that since function-key-map is a global map,
> applied before any other key processing, this will have side effects
> in /every/ mode, not just where you wanted separate definitions.  You
> could circumvent this in various hackish ways, I suppose

The entry in function-key-map doesn't have to be removed. You can bind
<tab> directly.

     Entries in `function-key-map' are ignored if they conflict with
     bindings made in the minor mode, local, or global keymaps. The
     intent is that the character sequences that function keys send
     should not have command bindings in their own right--but if they
     do, the ordinary bindings take priority.

(info "(elisp)Translation Keymaps")

-- 
Johan Bockgård

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

* Re: Separate bindings for the keyboard shortcuts Ctrl-i and TAB.
  2007-09-20 18:23     ` Johan Bockgård
@ 2007-09-20 19:37       ` Harald Hanche-Olsen
  0 siblings, 0 replies; 5+ messages in thread
From: Harald Hanche-Olsen @ 2007-09-20 19:37 UTC (permalink / raw)
  To: help-gnu-emacs

+ bojohan+news@dd.chalmers.se (Johan Bockgård):

>      Entries in `function-key-map' are ignored if they conflict with
>      bindings made in the minor mode, local, or global keymaps.

Great!  That should teach me a lesson.  Read the docs, all the docs,
and nothing but the docs.  8-)  Thanks for pointing that out.

-- 
* 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] 5+ messages in thread

end of thread, other threads:[~2007-09-20 19:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-17  8:49 Separate bindings for the keyboard shortcuts Ctrl-i and TAB Nordlöw
2007-09-17 11:16 ` Peter Dyballa
     [not found] ` <mailman.942.1190027818.18990.help-gnu-emacs@gnu.org>
2007-09-17 13:25   ` Harald Hanche-Olsen
2007-09-20 18:23     ` Johan Bockgård
2007-09-20 19:37       ` Harald Hanche-Olsen

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).