all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Input events and (interactive "e")
@ 2012-06-23 15:04 Eli Zaretskii
  2012-06-24  4:45 ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2012-06-23 15:04 UTC (permalink / raw)
  To: emacs-devel

Am I the only one, or do we indeed fail to document that
(interactive "e") is not just for mouse events?

The ELisp manual consistently talks about mouse events only, when it
discusses how to access non-keyboard input events and how to define
functions that are run by these events.  By just reading the manual,
you might think that only mouse events have meaningful parameters in
the event list, and only commands bound to mouse events can access
them using the event-* functions But in fact, it looks like _any_
event generated by the command loop can be bound to a command, and
that command can access the event parameters by treating its argument
as a list, using (interactive "e") to get that argument.  For example,
on Windows I can do this:

 (defun my-lang-change (event)
     ""
   (interactive "e")
   (message "%S" event))
 (global-set-key [language-change] 'my-lang-change)

and the pressing Alt-Shift to switch keyboard layout will show in the
echo area the contents of the event list produced for the
language-change event.

Also, the way to bind such events to commands is not documented at
all, AFAICS.

Is all of this omitted from the documentation on purpose, or should we
add that?

And btw, what is the story behind special-event-map, and why should
events be put on that map?  E.g., is it bad that language-change event
is not on that map?



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

end of thread, other threads:[~2012-06-25  2:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-23 15:04 Input events and (interactive "e") Eli Zaretskii
2012-06-24  4:45 ` Stefan Monnier
2012-06-24 11:49   ` Juanma Barranquero
2012-06-24 16:07     ` Eli Zaretskii
2012-06-24 13:14   ` Drew Adams
2012-06-24 15:51   ` Eli Zaretskii
2012-06-24 18:57     ` Stefan Monnier
2012-06-24 19:28       ` Eli Zaretskii
2012-06-25  1:40         ` Stefan Monnier
2012-06-25  2:56           ` Eli Zaretskii

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.