unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#20097: 25.0.50; focus-out-hook doesn't work w/other emacsclient frame
@ 2015-03-12 11:38 Rasmus
  2015-03-12 15:01 ` Stefan Monnier
  0 siblings, 1 reply; 12+ messages in thread
From: Rasmus @ 2015-03-12 11:38 UTC (permalink / raw)
  To: 20097

Hi,

I think focus-out-hook doesn't work as expected when used with other
emacsclient that belong to the same daemon.  Of course I could be
misunderstanding the meaning of "input focus" cf. the docstring.

Try the following.  Start a new emacsclient.  Let's call its first GTK
frame 'A' (informally).  Do

1. Make (new-frame).  Let's call this frame 'B' (informally).
2. Make a new buffer in B and eval:
   (set (make-local-variable (quote focus-out-hook)) (quote delete-frame))
3. Switch focus to frame A.  I do so by clicking on A or using
   Super/M-TAB.  Notice that nothing happens
4. Now try this with another program that's not an emacsclient.  The
   Frame is closed as expected.

The real use case for this is an org-agenda desktop file that I use to
integrate the Org calendar with the system calendar button.

Thanks,
Ramus

GNU Emacs 25.0.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.8) of 2015-02-06 on x200s

-- 
When in doubt, do it!





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

* bug#20097: 25.0.50; focus-out-hook doesn't work w/other emacsclient frame
  2015-03-12 11:38 bug#20097: 25.0.50; focus-out-hook doesn't work w/other emacsclient frame Rasmus
@ 2015-03-12 15:01 ` Stefan Monnier
  2015-03-12 15:14   ` Rasmus
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2015-03-12 15:01 UTC (permalink / raw)
  To: Rasmus; +Cc: 20097

> I think focus-out-hook doesn't work as expected when used with other
> emacsclient that belong to the same daemon.  Of course I could be
> misunderstanding the meaning of "input focus" cf. the docstring.

`focus-out-hook' is run when focus moved away from Emacs (at least,
that's the intention).

If you want a hook run when switching between frames, then I think
you'll need to catch the `switch-frame' event (yes, this sucks: one is
a hook, the other is an event), which is normally handled by
handle-switch-frame via a binding in the global-map.

So IIUC I think that what you're seeing is not a bug.  But I'm not sure IUC.


        Stefan





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

* bug#20097: 25.0.50; focus-out-hook doesn't work w/other emacsclient frame
  2015-03-12 15:01 ` Stefan Monnier
@ 2015-03-12 15:14   ` Rasmus
  2020-01-15  5:30     ` Stefan Kangas
  0 siblings, 1 reply; 12+ messages in thread
From: Rasmus @ 2015-03-12 15:14 UTC (permalink / raw)
  To: monnier; +Cc: 20097

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> I think focus-out-hook doesn't work as expected when used with other
>> emacsclient that belong to the same daemon.  Of course I could be
>> misunderstanding the meaning of "input focus" cf. the docstring.
>
> `focus-out-hook' is run when focus moved away from Emacs (at least,
> that's the intention).
>
> If you want a hook run when switching between frames, then I think
> you'll need to catch the `switch-frame' event (yes, this sucks: one is
> a hook, the other is an event), which is normally handled by
> handle-switch-frame via a binding in the global-map.
>
> So IIUC I think that what you're seeing is not a bug.  But I'm not sure IUC.

Okay.  That's a shame...

—Rasmus

-- 
You people at the NSA are becoming my new best friends!





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

* bug#20097: 25.0.50; focus-out-hook doesn't work w/other emacsclient frame
  2015-03-12 15:14   ` Rasmus
@ 2020-01-15  5:30     ` Stefan Kangas
  2020-01-15 14:03       ` Stefan Monnier
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Kangas @ 2020-01-15  5:30 UTC (permalink / raw)
  To: Rasmus; +Cc: monnier, 20097

Rasmus <rasmus@gmx.us> writes:

> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>>> I think focus-out-hook doesn't work as expected when used with other
>>> emacsclient that belong to the same daemon.  Of course I could be
>>> misunderstanding the meaning of "input focus" cf. the docstring.
>>
>> `focus-out-hook' is run when focus moved away from Emacs (at least,
>> that's the intention).
>>
>> If you want a hook run when switching between frames, then I think
>> you'll need to catch the `switch-frame' event (yes, this sucks: one is
>> a hook, the other is an event), which is normally handled by
>> handle-switch-frame via a binding in the global-map.
>>
>> So IIUC I think that what you're seeing is not a bug.  But I'm not sure IUC.
>
> Okay.  That's a shame...

Does anyone else have an opinion here?  If I don't hear anything else
within a couple of weeks, I'll assume Stefan Monnier is correct, and
close this as notabug.

Best regards,
Stefan Kangas





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

* bug#20097: 25.0.50; focus-out-hook doesn't work w/other emacsclient frame
  2020-01-15  5:30     ` Stefan Kangas
@ 2020-01-15 14:03       ` Stefan Monnier
  2020-01-15 18:16         ` Stefan Kangas
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2020-01-15 14:03 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 20097, Rasmus

> Does anyone else have an opinion here?  If I don't hear anything else
> within a couple of weeks, I'll assume Stefan Monnier is correct, and
> close this as notabug.

You could turn it into a feature request, of course.


        Stefan






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

* bug#20097: 25.0.50; focus-out-hook doesn't work w/other emacsclient frame
  2020-01-15 14:03       ` Stefan Monnier
@ 2020-01-15 18:16         ` Stefan Kangas
  2020-01-15 19:08           ` Stefan Monnier
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Kangas @ 2020-01-15 18:16 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 20097, Rasmus

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Does anyone else have an opinion here?  If I don't hear anything else
>> within a couple of weeks, I'll assume Stefan Monnier is correct, and
>> close this as notabug.
>
> You could turn it into a feature request, of course.

Thanks.  If I understand correctly, the feature request is then to add
a new hook to be run when switching frames.

Best regards,
Stefan Kangas





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

* bug#20097: 25.0.50; focus-out-hook doesn't work w/other emacsclient frame
  2020-01-15 18:16         ` Stefan Kangas
@ 2020-01-15 19:08           ` Stefan Monnier
  2020-01-15 19:16             ` Stefan Kangas
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2020-01-15 19:08 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 20097, Rasmus

> Thanks.  If I understand correctly, the feature request is then to add
> a new hook to be run when switching frames.

I guess so, yes.  But please clarify exactly what you mean by "switching
frame".  E.g. consider the difference between
- changing focus from the window manager
- selecting another frame with `select-frame`.
- hitting M-x in a minibuffer-free frame (which lends you in the
  minibuffer of another frame, e.g. in a minibuffer-only frame).


        Stefan






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

* bug#20097: 25.0.50; focus-out-hook doesn't work w/other emacsclient frame
  2020-01-15 19:08           ` Stefan Monnier
@ 2020-01-15 19:16             ` Stefan Kangas
  2020-01-15 19:50               ` Stefan Monnier
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Kangas @ 2020-01-15 19:16 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 20097, Rasmus

retitle 20097 Add new hook to be run when switching frames
thanks

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Thanks.  If I understand correctly, the feature request is then to add
>> a new hook to be run when switching frames.
>
> I guess so, yes.  But please clarify exactly what you mean by "switching
> frame".  E.g. consider the difference between
> - changing focus from the window manager
> - selecting another frame with `select-frame`.
> - hitting M-x in a minibuffer-free frame (which lends you in the
>   minibuffer of another frame, e.g. in a minibuffer-only frame).

Thanks.  I guess figuring out the precise semantics will have to be
left as an exercise for whoever decides to implement this.

Best regards,
Stefan Kangas





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

* bug#20097: 25.0.50; focus-out-hook doesn't work w/other emacsclient frame
  2020-01-15 19:16             ` Stefan Kangas
@ 2020-01-15 19:50               ` Stefan Monnier
  2020-01-15 20:18                 ` Stefan Kangas
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2020-01-15 19:50 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 20097, Rasmus

> Thanks.  I guess figuring out the precise semantics will have to be
> left as an exercise for whoever decides to implement this.

Yes, but it's up to you to describe your use case with enough info that
the semantics that they choose is useful for you.


        Stefan






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

* bug#20097: 25.0.50; focus-out-hook doesn't work w/other emacsclient frame
  2020-01-15 19:50               ` Stefan Monnier
@ 2020-01-15 20:18                 ` Stefan Kangas
  2020-01-19 10:15                   ` bug#20097: " Rasmus Pank Roulund
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Kangas @ 2020-01-15 20:18 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 20097, Rasmus

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Thanks.  I guess figuring out the precise semantics will have to be
>> left as an exercise for whoever decides to implement this.
>
> Yes, but it's up to you to describe your use case with enough info that
> the semantics that they choose is useful for you.

I'm just triaging bugs, and don't have any use case to provide.
Perhaps the OP will be able to provide us with more details.

Best regards,
Stefan Kangas





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

* bug#20097: focus-out-hook doesn't work w/other emacsclient frame
  2020-01-15 20:18                 ` Stefan Kangas
@ 2020-01-19 10:15                   ` Rasmus Pank Roulund
  2020-08-12 16:21                     ` Stefan Kangas
  0 siblings, 1 reply; 12+ messages in thread
From: Rasmus Pank Roulund @ 2020-01-19 10:15 UTC (permalink / raw)
  To: 20097

Stefan Kangas <stefan@marxist.se> writes:

> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>>> Thanks.  I guess figuring out the precise semantics will have to be
>>> left as an exercise for whoever decides to implement this.
>>
>> Yes, but it's up to you to describe your use case with enough info that
>> the semantics that they choose is useful for you.
>
> I'm just triaging bugs, and don't have any use case to provide.
> Perhaps the OP will be able to provide us with more details.

I hardly remember at this point.

I think I wanted to use it for opening an Org Agenda view via Gnome Shell
and (type <Super> agenda, opening an emacsclient) and get rid of the
window once I click somewhere else.

Feel free to close.

Rasmus

--
The right to be left alone is a human right





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

* bug#20097: focus-out-hook doesn't work w/other emacsclient frame
  2020-01-19 10:15                   ` bug#20097: " Rasmus Pank Roulund
@ 2020-08-12 16:21                     ` Stefan Kangas
  0 siblings, 0 replies; 12+ messages in thread
From: Stefan Kangas @ 2020-08-12 16:21 UTC (permalink / raw)
  To: Rasmus Pank Roulund; +Cc: 20097-done

Rasmus Pank Roulund <rasmus@gmx.us> writes:

>>> Yes, but it's up to you to describe your use case with enough info that
>>> the semantics that they choose is useful for you.
>>
>> I'm just triaging bugs, and don't have any use case to provide.
>> Perhaps the OP will be able to provide us with more details.
>
> I hardly remember at this point.
>
> I think I wanted to use it for opening an Org Agenda view via Gnome Shell
> and (type <Super> agenda, opening an emacsclient) and get rid of the
> window once I click somewhere else.
>
> Feel free to close.

Thanks, it seems to be that it will be hard to make any progress here
without having a specific use-case.

I'm therefore closing this bug report.

Best regards,
Stefan Kangas





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

end of thread, other threads:[~2020-08-12 16:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-12 11:38 bug#20097: 25.0.50; focus-out-hook doesn't work w/other emacsclient frame Rasmus
2015-03-12 15:01 ` Stefan Monnier
2015-03-12 15:14   ` Rasmus
2020-01-15  5:30     ` Stefan Kangas
2020-01-15 14:03       ` Stefan Monnier
2020-01-15 18:16         ` Stefan Kangas
2020-01-15 19:08           ` Stefan Monnier
2020-01-15 19:16             ` Stefan Kangas
2020-01-15 19:50               ` Stefan Monnier
2020-01-15 20:18                 ` Stefan Kangas
2020-01-19 10:15                   ` bug#20097: " Rasmus Pank Roulund
2020-08-12 16:21                     ` Stefan Kangas

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