help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Key binding syntax


From: Kevin Rodgers
Subject: Re: Key binding syntax
Date: Mon, 11 Apr 2005 16:24:30 -0600
User-agent: Mozilla Thunderbird 0.9 (X11/20041105)

Greg Novak wrote:
> I'm having a difficult time rebinding Shift-tab or Control tab.  I've
> tried:
>
> [?\C-tab]

That won't work, because the part that follows ?\C- must be a character,
and the tab symbol represents a function key.  If you evaluate that, you
get [20 ab], which is a vector of the Control-t character and the ab
symbol.

> [?\C- tab]

Similarly, that is Control-SPC followed by the tab symbol/function key.

> "\C-<tab>"
> "\C-[tab]"

Those appear to be random guesses.  (Within a string, you can only have
characters.)

<tab> is a human-readable output representation for the function key,
not a Lisp-readable input representation.  [tab] is a readable input
representation for the function key, but it doesn't have any special
meaning within a string.

> "\C-\t"

If you try to evaluate that, you get an "Invalid modifier in string"
error.  That's because the \t character (aka TAB) is already a control
character (Control-i).

I'll admit, I don't know why the analogous vector notation [?\C-\t]
doesn't fail for that same reason.

> as the first argument to local-set-key and none of them seem to work.
> I've read the Emacs manual and the Elisp manual, but I can't find the
> information I need.

I would use [C-tab] and [S-tab], to bind the modified tab function key
(vs. the modified TAB character, which is problematical).

> I also did "apropos-command key" looking for a command where I can hit
> a key and have emacs tell me the exact text that should go into the
> first argument to local-set-key in order to rebind the key.  Much like
> describe-key, but telling me how to rebind it, not what the current
> current binding happens to be.

Try typing `C-h k' followed by the key sequence you want to bind, and
then `C-h l'.  It will show `C-h k <C-tab> C-h l' in the *Help* buffer.
The idiot-proof way to make use of that information (please note, I'm
not calling you an idiot!) is:

(kbd "<C-tab>")

which evaluates to [C-tab].

> I still think that this function must exist, and I'm just not finding
> it.  So before I try to write it myself, I thought I'd consult the
> list...

--
Kevin Rodgers





reply via email to

[Prev in Thread] Current Thread [Next in Thread]