all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: emacs-devel@gnu.org
Subject: Input events and (interactive "e")
Date: Sat, 23 Jun 2012 18:04:48 +0300	[thread overview]
Message-ID: <83lijeax2n.fsf@gnu.org> (raw)

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?



             reply	other threads:[~2012-06-23 15:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-23 15:04 Eli Zaretskii [this message]
2012-06-24  4:45 ` Input events and (interactive "e") 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83lijeax2n.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.