unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Bikeshedding go! Why is <M-f4> unbound?
@ 2011-01-05 14:48 Deniz Dogan
  2011-01-05 15:29 ` Óscar Fuentes
  2011-01-05 15:31 ` Christopher Allan Webber
  0 siblings, 2 replies; 121+ messages in thread
From: Deniz Dogan @ 2011-01-05 14:48 UTC (permalink / raw)
  To: Emacs-Devel devel

Is there any particular reason to why <M-f4> is not bound to something
like `save-buffers-kill-terminal' in Emacs?

I think <M-f4> (or Alt+F4) can be seen as a pretty standard key
binding for quitting a graphical application these days.

-- 
Deniz Dogan



^ permalink raw reply	[flat|nested] 121+ messages in thread
* Re: Bikeshedding go! Why is <M-f4> unbound?
@ 2011-01-14  1:20 grischka
  0 siblings, 0 replies; 121+ messages in thread
From: grischka @ 2011-01-14  1:20 UTC (permalink / raw)
  To: monnier; +Cc: emacs-devel

>>>> When Alt-F4 is delegated to Windows, it generates events for closing the
>>>> active window.
>>> Thanks.  So the right thing to do here is to change Emacs so it delegates
>>> the Alt-F4 to the standard Windows routine that turns it into a WM_CLOSE.
>>> Patch welcome,
>> Binding Alt-F4 to a function such as handle-delete-frame will do
>> fine. That's far easier than dealing with the Windows API from the C
>> sources.
> 
> It's likely to end up approximating the right behavior, and lead to
> more reports.  E.g. should it bind A-f4 or M-f4?

There is this in w32fns.c:
     case WM_KEYDOWN:
     case WM_SYSKEYDOWN:
         ...

which basically should be
     case WM_SYSKEYDOWN:
	if (!is_key_bound_in_emacs(key_param))
              goto dflt;
     case WM_KEYDOWN:
         ...

Provided that emacs has a way to check whether a key is bound,
on that level.  And if so that the method can be called from
another thread ;)

--- grischka




^ permalink raw reply	[flat|nested] 121+ messages in thread
* Re: Bikeshedding go! Why is <M-f4> unbound?
@ 2011-01-17 12:06 grischka
  2011-01-17 12:23 ` Lennart Borgman
                   ` (2 more replies)
  0 siblings, 3 replies; 121+ messages in thread
From: grischka @ 2011-01-17 12:06 UTC (permalink / raw)
  To: lennart.borgman; +Cc: emacs-devel

> What I really hoped to discuss where the technical difficulties. Emacs
> does not currently have a way to let key binding fall back to the OS
> binding. I am not sure it is trivial and I have forgotten the details.

It is nontrivial to say the least.

Unlike XEmacs, GNU Emacs is still a console application at its heart.
It wants to "read" events in a loop from an input stream until it
finds them complete as a "key-sequence".  No function seems to exist
that could deal with events that are already read.

So I guess at first you'd need to convert keyboard.c:read_key_sequence()
from procedural logic into a state machine such that it does not call
'read_key()' on its own but instead can be fed with keys one by one.
Once you have that however you can as well run the Windows backend in
the same thread and many things become much simpler ;)

--- grischka




^ permalink raw reply	[flat|nested] 121+ messages in thread
* RE: Bikeshedding go! Why is <M-f4> unbound?
@ 2011-01-17 20:31 Drew Adams
  2011-01-17 20:53 ` Lennart Borgman
  0 siblings, 1 reply; 121+ messages in thread
From: Drew Adams @ 2011-01-17 20:31 UTC (permalink / raw)
  To: lennart.borgman; +Cc: monnier, pj, emacs-devel

> > So far it seems to have been agreed that in any case 
> > (whatever is done or not done) both users and libraries
> > should feel free to bind M-f4 in Emacs.
> 
> This is a misunderstanding. We have not even been discussing this. No
> one has said that users and libraries should not be able to bind M-f4.

I don't know what the misunderstanding is.  You seem to be in violent agreement.
We are both saying that it is agreed by all that users and libraries should be
able to bind M-f4 in Emacs.

If you agree, then in your words, "how both users and libraries could decide on
this"?  The answer to that applies also to how both can decide about the
behavior of unbound M-f4 (whether to raise an error or pass to Windows).

> >> >> No one has suggested that Alt+F4 should be hardcoded to be
> >> >> sent to w32.
> >> >
> >> > Odd that you would say this just after you asked what other
> >> > behavior could possibly exist.
> >>
> >> Could you please be a bit more exact in your questions?
> >
> > See what you wrote at the top.  You've made it very clear 
> > that you want Alt+f4 hard-coded to pass through to Windows
> > when unbound in Emacs.
> 
> Please do not try to win by dismissing important details, it is
> useless and wastes our time. You are mixing to very different things
> here.

No idea what you're talking about.  What details? What two things?

You stated both (a) "Yes, I actually do prefer #3 hard-coded" and (b) "No one
has suggested that Alt+F4 should be hardcoded to be sent to w32."  (The latter
was in the context of handling an _unbound_ key.)  You are someone, not no one.

I think (but am not sure at this point) that your position is (a): you want to
hard-code the behavior that unbound Alt+F4/M-f4 should always be sent to w32.




^ permalink raw reply	[flat|nested] 121+ messages in thread
* Re: Bikeshedding go! Why is <M-f4> unbound?
@ 2011-01-18  9:36 grischka
  2011-01-18 12:58 ` Óscar Fuentes
  0 siblings, 1 reply; 121+ messages in thread
From: grischka @ 2011-01-18  9:36 UTC (permalink / raw)
  To: ofv; +Cc: emacs-devel

> This is unnecesary. The Windows event loop coded into Emacs already
> receives Alt-F4 in a single event. What is needed is to determine from
> that event loop if there is a binding for Alt-F4 (created with *-set-key
> etc). Once we know that there is no such binding, it is trivial to send
> back the Alt-F4 event back to Windows.

Well, it would be difficult to determine on the Windows level whether
the single keystroke was maybe part of C-x M-f4 or C-h M-f4.  So in
any case it is better to reuse emacs central event parser.

To make some suggestion that could work:  Store the key-code in a
variable like this:

     case WM_SYSKEYDOWN:
         last_syskey_code = wParam;
         ...

define keys emacs-wise like this:

     (global-set-key [M-f4] 'w32-syskey)

with

     DEFUN w32_syskey() {
         PostMessage(frame_wnd, WM_EMACS_SYSKEY, last_syskey_code, 0);
     }

and in wnd_proc()

     case WM_EMACS_SYSKEY:
         return DefWindowProc(hwnd, WM_SYSKEYDOWN, wParam, 0);


All untested.  Also note that for Alt-<letter> keys, WM_SYSCHAR needs
to be handled as well.

--- grischka




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

end of thread, other threads:[~2011-01-20 20:10 UTC | newest]

Thread overview: 121+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-05 14:48 Bikeshedding go! Why is <M-f4> unbound? Deniz Dogan
2011-01-05 15:29 ` Óscar Fuentes
2011-01-05 17:11   ` Deniz Dogan
2011-01-05 17:30     ` Eli Zaretskii
2011-01-05 17:36       ` Deniz Dogan
2011-01-05 18:15         ` Óscar Fuentes
2011-01-09 22:00           ` Lennart Borgman
2011-01-10  1:01             ` Drew Adams
2011-01-10  1:46               ` Lennart Borgman
2011-01-10  3:01                 ` Drew Adams
2011-01-10  3:08                   ` Lennart Borgman
2011-01-12 13:53               ` Stuart Hacking
2011-01-12 15:01                 ` Drew Adams
2011-01-12 15:54                   ` Deniz Dogan
2011-01-12 17:17                     ` Drew Adams
2011-01-12 20:29                       ` Chad Brown
2011-01-12 20:32                     ` Stefan Monnier
2011-01-12 20:42                       ` Deniz Dogan
2011-01-13  2:42                         ` Stefan Monnier
2011-01-13  3:13                           ` Lennart Borgman
2011-01-13  3:59                           ` Óscar Fuentes
2011-01-13  4:15                             ` Lennart Borgman
2011-01-13 13:13                               ` Óscar Fuentes
2011-01-13 16:57                             ` Stefan Monnier
2011-01-13 18:05                               ` Óscar Fuentes
2011-01-13 21:15                                 ` Stefan Monnier
2011-01-13 22:00                                   ` Lennart Borgman
2011-01-14  0:12                                     ` Jason Rumney
2011-01-14  0:21                                       ` Lennart Borgman
2011-01-14  5:02                                         ` Jason Rumney
2011-01-14  8:28                                           ` Lennart Borgman
2011-01-13 22:18                               ` Drew Adams
2011-01-13 22:30                                 ` Lennart Borgman
2011-01-13 22:47                                   ` Drew Adams
2011-01-13 23:04                                     ` Óscar Fuentes
2011-01-13 23:14                                     ` Lennart Borgman
2011-01-14  9:25                                     ` Giorgos Keramidas
2011-01-14  9:43                                       ` Lennart Borgman
2011-01-13 22:53                                 ` Stuart Hacking
2011-01-13 23:10                                   ` Lennart Borgman
2011-01-14  0:13                                 ` Jason Rumney
2011-01-14  1:35                                   ` Drew Adams
2011-01-14  5:08                                     ` Jason Rumney
2011-01-14 10:49                             ` PJ Weisberg
2011-01-14 15:21                               ` Lennart Borgman
2011-01-14 15:48                               ` Stefan Monnier
2011-01-15  0:07                                 ` Óscar Fuentes
2011-01-15 11:41                                 ` Lennart Borgman
2011-01-16 21:49                                   ` Drew Adams
     [not found]                                     ` <227F94B0AC1649C1A41082A24!9921783@us.oracle!! .com>
     [not found]                                     ` <227F94B0AC1649C1A41082A24! 9921783@us.oracle! .com>
     [not found]                                     ` <227F94B0AC1649C1A41082A24!9921783@us.oracle!! !  .com>
2011-01-16 23:53                                     ` Lennart Borgman
2011-01-17  1:40                                       ` Drew Adams
2011-01-17  1:52                                         ` Drew Adams
2011-01-17  8:32                                         ` Lennart Borgman
2011-01-17 18:22                                           ` Drew Adams
2011-01-17 18:36                                             ` Lennart Borgman
2011-01-17 19:02                                               ` Drew Adams
2011-01-17 19:27                                                 ` Lennart Borgman
2011-01-18  3:20                                                 ` Bikeshedding "user choice" Stephen J. Turnbull
2011-01-18  5:29                                                   ` Drew Adams
2011-01-18  6:11                                                     ` Stephen J. Turnbull
2011-01-18 17:45                                                       ` Drew Adams
2011-01-19  4:59                                                         ` Stephen J. Turnbull
2011-01-19 19:34                                                           ` Drew Adams
2011-01-18  8:06                                                 ` Bikeshedding go! Why is <M-f4> unbound? jasonr
2011-01-17 19:27                                             ` Óscar Fuentes
2011-01-17 20:24                                               ` Drew Adams
2011-01-17  2:27                                     ` Jason Rumney
2011-01-17 18:21                                       ` Drew Adams
2011-01-16 21:49                                 ` Drew Adams
2011-01-14 17:58                               ` Drew Adams
2011-01-14 20:27                                 ` Lennart Borgman
2011-01-14 22:24                                   ` Drew Adams
     [not found]                                     ` <D727BC7268A24AF7B9544FD4E0B74E11@us! .oracle.com>
2011-01-14 22:43                                     ` Lennart Borgman
2011-01-16 21:49                                       ` Drew Adams
2011-01-16 23:49                                         ` Lennart Borgman
2011-01-17  0:33                                           ` Philipp Haselwarter
2011-01-17  1:41                                             ` Drew Adams
2011-01-17  1:45                                           ` Drew Adams
2011-01-17  8:29                                             ` Lennart Borgman
2011-01-17  8:47                                               ` Stephen J. Turnbull
2011-01-17  9:23                                                 ` Lennart Borgman
2011-01-17 18:22                                                 ` Drew Adams
2011-01-17 18:22                                               ` Drew Adams
2011-01-15  2:38                                 ` PJ Weisberg
2011-01-16 21:49                                   ` Drew Adams
2011-01-10 10:15             ` Dimitri Fontaine
2011-01-05 15:31 ` Christopher Allan Webber
  -- strict thread matches above, loose matches on Subject: below --
2011-01-14  1:20 grischka
2011-01-17 12:06 grischka
2011-01-17 12:23 ` Lennart Borgman
2011-01-17 14:37 ` Óscar Fuentes
2011-01-17 16:56   ` Lennart Borgman
2011-01-18  3:03 ` Stephen J. Turnbull
2011-01-18  9:11   ` Lennart Borgman
2011-01-18 12:10   ` grischka
2011-01-17 20:31 Drew Adams
2011-01-17 20:53 ` Lennart Borgman
2011-01-17 21:56   ` Drew Adams
2011-01-17 22:23     ` Lennart Borgman
2011-01-17 23:17       ` Drew Adams
2011-01-17 23:58         ` Lennart Borgman
2011-01-18  0:36           ` Drew Adams
2011-01-18  0:47             ` Lennart Borgman
2011-01-18  1:20               ` Drew Adams
2011-01-18  1:38                 ` Lennart Borgman
2011-01-18  3:14                   ` Drew Adams
2011-01-18  4:06                     ` Stephen J. Turnbull
2011-01-18  9:36 grischka
2011-01-18 12:58 ` Óscar Fuentes
2011-01-18 13:15   ` grischka
2011-01-18 13:27     ` Óscar Fuentes
2011-01-18 17:20       ` Drew Adams
2011-01-19 10:08         ` Stuart Hacking
2011-01-19 19:37           ` Drew Adams
2011-01-20  1:00             ` PJ Weisberg
2011-01-20 17:12               ` Drew Adams
2011-01-20 20:10                 ` PJ Weisberg
2011-01-18 13:33     ` Lennart Borgman
2011-01-18 13:51       ` Óscar Fuentes
2011-01-18 17:40         ` Lennart Borgman
2011-01-18 17:52           ` Óscar Fuentes

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