all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Key binding syntax
@ 2005-04-11 21:22 Greg Novak
  2005-04-11 22:07 ` Jesper Harder
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Greg Novak @ 2005-04-11 21:22 UTC (permalink / raw)


I'm having a difficult time rebinding Shift-tab or Control tab.  I've
tried:

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

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

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

Thank you,
Greg

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

* Re: Key binding syntax
  2005-04-11 21:22 Key binding syntax Greg Novak
@ 2005-04-11 22:07 ` Jesper Harder
  2005-04-11 22:11 ` Peter Dyballa
  2005-04-11 22:24 ` Kevin Rodgers
  2 siblings, 0 replies; 4+ messages in thread
From: Jesper Harder @ 2005-04-11 22:07 UTC (permalink / raw)


Greg Novak <novak@dionysus.ucolick.org> writes:

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

You can use the output from `describe-key' (C-h k) in the `kbd' macro.
E.g.

       (global-set-key (kbd "<S-tab>") 'tetris)

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

* Re: Key binding syntax
  2005-04-11 21:22 Key binding syntax Greg Novak
  2005-04-11 22:07 ` Jesper Harder
@ 2005-04-11 22:11 ` Peter Dyballa
  2005-04-11 22:24 ` Kevin Rodgers
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Dyballa @ 2005-04-11 22:11 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 11.04.2005 um 23:22 schrieb Greg Novak:

> I'm having a difficult time rebinding Shift-tab or Control tab.

You have some easy choices to do it right!

1. Just type 'M-x global-set-key RET C-TAB RET <function> RET'. Now the 
key has a binding, but you want to know which. So type again: 'M-x 
repeat-complex-command C-a C-k C-g C-x f ~/.emacs RET C-y' or 'C-x ESC 
ESC C-a C-k C-g C-x f ~/.emacs RET C-y' -- got it? When you invoke 
repeat-complex-command the cursor warps into the minibuffer. There you 
can go to the beginning of the line and kill it. To kill the active 
minibuffer send it a keyboard-quit. Now open .emacs and yank the killed 
into it!

2. Describe-key, C-h k, describes more exactly what the key does. To 
retrieve its key-code invoke again repeat-complex-command and copy it 
out of the minibuffer for use in .emacs.

--
Greetings

   Pete

The human animal differs from the lesser primates in his passion for 
lists of "Ten Best".
		-- H. Allen Smith

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

* Re: Key binding syntax
  2005-04-11 21:22 Key binding syntax Greg Novak
  2005-04-11 22:07 ` Jesper Harder
  2005-04-11 22:11 ` Peter Dyballa
@ 2005-04-11 22:24 ` Kevin Rodgers
  2 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2005-04-11 22:24 UTC (permalink / raw)


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

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

end of thread, other threads:[~2005-04-11 22:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-11 21:22 Key binding syntax Greg Novak
2005-04-11 22:07 ` Jesper Harder
2005-04-11 22:11 ` Peter Dyballa
2005-04-11 22:24 ` Kevin Rodgers

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.