unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Modifier state?
@ 2009-02-13 20:18 David Reitter
  2009-02-13 20:25 ` Drew Adams
  2009-02-14  1:43 ` Stefan Monnier
  0 siblings, 2 replies; 4+ messages in thread
From: David Reitter @ 2009-02-13 20:18 UTC (permalink / raw)
  To: Emacs-Devel devel

Do we have a way to detect the modifier state from the Lisp level, or  
bind commands to modifier state changes?

I'd like to run a command whenever the user presses and releases the  
Meta (not ESC) key.  This would be on non-TTY sessions.

A lot of applications show additional info when you press Alt/Option  
(which is Meta for me); they even update the menus with alternative  
functions.  The user can even view a menu, press and hold Alt/Option  
and see the menu items change.

Thanks
- David




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

* RE: Modifier state?
  2009-02-13 20:18 Modifier state? David Reitter
@ 2009-02-13 20:25 ` Drew Adams
  2009-02-14  1:43 ` Stefan Monnier
  1 sibling, 0 replies; 4+ messages in thread
From: Drew Adams @ 2009-02-13 20:25 UTC (permalink / raw)
  To: 'David Reitter', 'Emacs-Devel devel'

> Do we have a way to detect the modifier state from the Lisp 
> level, or bind commands to modifier state changes?
> 
> I'd like to run a command whenever the user presses and releases the  
> Meta (not ESC) key.  This would be on non-TTY sessions.
> 
> A lot of applications show additional info when you press Alt/Option  
> (which is Meta for me); they even update the menus with alternative  
> functions.  The user can even view a menu, press and hold Alt/Option  
> and see the menu items change.

Someone else will perhaps correct this or provide more up-to-date info, but you
might take a look at function `event-modifiers'.

See the Elisp manual, nodes Keyboard Events and Classifying Events.





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

* Re: Modifier state?
  2009-02-13 20:18 Modifier state? David Reitter
  2009-02-13 20:25 ` Drew Adams
@ 2009-02-14  1:43 ` Stefan Monnier
  2009-02-14 14:34   ` David Reitter
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2009-02-14  1:43 UTC (permalink / raw)
  To: David Reitter; +Cc: Emacs-Devel devel

> Do we have a way to detect the modifier state from the Lisp level, or bind
> commands to modifier state changes?

No.

I did some simple experiments with it, in order to get events like
<control> and <down-control> (which actually were <down-control> and
<C-control> because when the release event is received, the modifier
state is not yet cleared).  I did get it to work OK without too much
trouble (mostly I had to add some function-key-map entries to drop those
events when not bound, and I had to rework C-q so that it waits for
a "real" key press rather than stopping at the <down-control>), but
haven't investigated much further.


        Stefan




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

* Re: Modifier state?
  2009-02-14  1:43 ` Stefan Monnier
@ 2009-02-14 14:34   ` David Reitter
  0 siblings, 0 replies; 4+ messages in thread
From: David Reitter @ 2009-02-14 14:34 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs-Devel devel

[-- Attachment #1: Type: text/plain, Size: 828 bytes --]

On 13 Feb 2009, at 20:43, Stefan Monnier wrote:

>> Do we have a way to detect the modifier state from the Lisp level,  
>> or bind
>> commands to modifier state changes?
>
> No.
>
> I did some simple experiments with it, in order to get events like
> <control> and <down-control> (which actually were <down-control> and
> <C-control> because when the release event is received, the modifier
> state is not yet cleared).  I did get it to work OK without too much
> trouble (mostly I had to add some function-key-map entries to drop  
> those
> events when not bound, and I had to rework C-q so that it waits for
> a "real" key press rather than stopping at the <down-control>), but
> haven't investigated much further.

And I guess there's a bit of port-specific work involved, too.
It would be excellent to have this post-23.1.

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 2193 bytes --]

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

end of thread, other threads:[~2009-02-14 14:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-13 20:18 Modifier state? David Reitter
2009-02-13 20:25 ` Drew Adams
2009-02-14  1:43 ` Stefan Monnier
2009-02-14 14:34   ` David Reitter

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