emacs-devel
[Top][All Lists]
Advanced

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

Re: Bikeshedding go! Why is <M-f4> unbound?


From: Óscar Fuentes
Subject: Re: Bikeshedding go! Why is <M-f4> unbound?
Date: Sat, 15 Jan 2011 01:07:26 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> It sounds like the 'correct' thing to do is is to call
>> let_Windows_process_it() whenever any "<foo-key> is undefined" message
>> is reported.
>
> Yes, that's another way to attack the problem.  And it would make sense.

If you insist on working at the C level, just handle Alt-F4 as if it
were WM_CLOSE:

swich(event) {
...
case WM_KEYDOWN:
  if( key is Alt-F4 and is unbound )
    do the same as WM_CLOSE

I have no idea how complex is to check from w32term.c if a key is bound.

I can't see why just adding something like

(global-set-key [M-f4] 'delete-frame-maybe-exit-emacs)

is wrong.

>> The question of how difficult that would be to do is another matter.
>
> Indeed, there are several potential difficulties:
> - the time when "<foo-key> is undefined" is run can be much later than
>   when we received the key event from Windows (some other events may
>   have been received in the mean time already, for example), so that
>   might cause extra difficulties.
> - when we get to "<foo-key> is undefined", the event has been remapped
>   a few times, so it can be far from obvious how to turn the resulting
>   Elisp event and turn it back into its original Windows event (tho,
>   we normally have access to the raw (un-remapped) Elisp event, so some
>   of that work is done).
>
> A simpler solution is to dump the problem onto the user: setup
> a `w32-passthrough-events' where the user can specify events that should
> be passed on to Windows's standard lib rather than handled by Emacs.

This is overkill. There are just a few candidates for "events that Emacs
receives but maybe are worth delegating to Windows". One is Alt-F4,
another Ctrl-Space (which activates the application's system menu) Maybe
there is some other. Not worth the trouble, IMO.

> But it still leaves open the question whether it should contain M-f4 or
> A-f4 (or use yet-another event representation),

Is there an [A-f4] key event on Emacs running on Windows? I mean, I've
never seen one. My keyboard says "Alt" but whenever I use that modifier,
Emacs says [M-whatever].

> as well as what happens
> when the user hits C-x M-f4.

That's simple: Alt-F4 is the same as clicking on the window's close
button, so do the same as C-x <click close button>. Hmmm, I see, maybe
that's not possible from Lisp.




reply via email to

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