* Binding C-i breaks TAB bindings (was bug#13861)
[not found] ` <handler.13861.D13861.1362336754560.notifdone@debbugs.gnu.org>
@ 2013-03-04 7:01 ` Ivan Kanis
2013-03-04 14:28 ` Stefan Monnier
0 siblings, 1 reply; 5+ messages in thread
From: Ivan Kanis @ 2013-03-04 7:01 UTC (permalink / raw)
To: Glenn Morris; +Cc: Emacs Development List
March, 03 at 14:27 Ivan wrote:
> emacs -Q
> in the scratch buffer type:
>
> (global-set-key [?\C-i] 'jumpc-jump-forward)
>
> press the TAB key.
>
> I get the following error:
> command-execute: Symbol's function definition is void:
> jumpc-jump-forward
March, 03 at 18:53 Glenn wrote:
> This is explicitly explained in the "Function Keys" section of the ELisp
> manual.
Hi Glenn,
I just read the manual at the given section. I see that <tab> is the
name of the corresponding Lisp symbols [1].
[?\C-i] is a vector, surely it shouldn't override <tab> ?
Ivan
[1] I don't see it in the variables, is it a special name space?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Binding C-i breaks TAB bindings (was bug#13861)
2013-03-04 7:01 ` Binding C-i breaks TAB bindings (was bug#13861) Ivan Kanis
@ 2013-03-04 14:28 ` Stefan Monnier
2013-03-04 17:59 ` Ivan Kanis
0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2013-03-04 14:28 UTC (permalink / raw)
To: Ivan Kanis; +Cc: Emacs Development List
> [?\C-i] is a vector, surely it shouldn't override <tab> ?
The fact that it's a vector is irrelevant, because you're comparing two
different notations: either compare [?\C-i] with [tab], or compare
"C-i" with "<tab>".
In any case <tab> is not overridden. It's just that you don't have any
binding for <tab> so function-key-map makes Emacs fallback on the
C-i binding.
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Binding C-i breaks TAB bindings (was bug#13861)
2013-03-04 14:28 ` Stefan Monnier
@ 2013-03-04 17:59 ` Ivan Kanis
2013-03-04 18:21 ` Ivan Andrus
2013-03-04 18:56 ` Stefan Monnier
0 siblings, 2 replies; 5+ messages in thread
From: Ivan Kanis @ 2013-03-04 17:59 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Emacs Development List
March, 04 at 9:28 Stefan wrote:
> In any case <tab> is not overridden. It's just that you don't have any
> binding for <tab> so function-key-map makes Emacs fallback on the
> C-i binding.
OK, I think I finally understand.
C-h k TAB => TAB (translated from <tab>) runs the command ...
I missed the 'translated from' bit.
I am trying to free up C-i for my nefarious purpose. Does that mean I
have to fix each mode I use to bind the <tab> key to the proper command?
Is there a programmatic way?
--
Art washes from the soul the dust of everyday life.
-- Pablo Picasso
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Binding C-i breaks TAB bindings (was bug#13861)
2013-03-04 17:59 ` Ivan Kanis
@ 2013-03-04 18:21 ` Ivan Andrus
2013-03-04 18:56 ` Stefan Monnier
1 sibling, 0 replies; 5+ messages in thread
From: Ivan Andrus @ 2013-03-04 18:21 UTC (permalink / raw)
To: Ivan Kanis; +Cc: Stefan Monnier, Emacs Development List
On Mar 4, 2013, at 10:59 AM, Ivan Kanis <banana@kanis.fr> wrote:
> March, 04 at 9:28 Stefan wrote:
>
>> In any case <tab> is not overridden. It's just that you don't have any
>> binding for <tab> so function-key-map makes Emacs fallback on the
>> C-i binding.
>
> OK, I think I finally understand.
>
> C-h k TAB => TAB (translated from <tab>) runs the command ...
>
> I missed the 'translated from' bit.
>
> I am trying to free up C-i for my nefarious purpose. Does that mean I
> have to fix each mode I use to bind the <tab> key to the proper command?
> Is there a programmatic way?
The way I do it is by creating a minor-mode (called `gvol-mode'), and bind C-i to whatever I want. Then I bind <tab> to the function below which turns off gvol-mode and finds the "best" keybinding and runs it. It's not perfect, and you sometimes run into problems that are somewhat difficult to diagnose which I have worked around with the setq's.
HTH,
Ivan
(defun gvol-indent-for-tab-command ()
"This is to fix `indent-for-tab-command' for `gvol-mode'.
It runs [tab] or C-i with `gvol-mode' nil because `gvol-mode'
binds C-i to a different command. Ideally this should take into
account window system so that it can DTRT in a terminal (whatever
the right thing is)."
(interactive)
(let* ((gvol-mode nil)
(command (or (key-binding [tab])
(key-binding "\C-i"))))
;; This is to satisfy `python-indent-line' which checks
;; `this-command' to cycle
(setq this-command 'indent-for-tab-command)
;; Make people think this was called with C-i. This allows
;; `self-insert-command' to work
(setq last-command-event 9)
(call-interactively command)))
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Binding C-i breaks TAB bindings (was bug#13861)
2013-03-04 17:59 ` Ivan Kanis
2013-03-04 18:21 ` Ivan Andrus
@ 2013-03-04 18:56 ` Stefan Monnier
1 sibling, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2013-03-04 18:56 UTC (permalink / raw)
To: Ivan Kanis; +Cc: Emacs Development List
>> In any case <tab> is not overridden. It's just that you don't have any
>> binding for <tab> so function-key-map makes Emacs fallback on the
>> C-i binding.
> I am trying to free up C-i for my nefarious purpose.
In a tty, TAB and C-i can't be distinguished (at least, most/all
terminal emulators will send the exact same byte sequences in both cases
by default), so there isn't much you can do there.
But in a GUI session, you could add something like
(define-key input-decode-map [?\C-i] [control-i])
This way, `tab' will work the same as ever, but C-i will now generate
a new event `control-i' which you can bind to any command you like.
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-03-04 18:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <rjobf0uxi4.fsf@fencepost.gnu.org>
[not found] ` <87a9qklpoa.fsf@kanis.fr>
[not found] ` <handler.13861.D13861.1362336754560.notifdone@debbugs.gnu.org>
2013-03-04 7:01 ` Binding C-i breaks TAB bindings (was bug#13861) Ivan Kanis
2013-03-04 14:28 ` Stefan Monnier
2013-03-04 17:59 ` Ivan Kanis
2013-03-04 18:21 ` Ivan Andrus
2013-03-04 18:56 ` Stefan Monnier
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).