GNU bug report logs - #20097
Add new hook to be run when switching frames

Previous Next

Package: emacs;

Reported by: Rasmus <rasmus <at> gmx.us>

Date: Thu, 12 Mar 2015 11:40:03 UTC

Severity: wishlist

Found in version 25.0.50

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 20097 in the body.
You can then email your comments to 20097 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#20097; Package emacs. (Thu, 12 Mar 2015 11:40:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Rasmus <rasmus <at> gmx.us>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 12 Mar 2015 11:40:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rasmus <rasmus <at> gmx.us>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.50; focus-out-hook doesn't work w/other emacsclient frame
Date: Thu, 12 Mar 2015 12:38:42 +0100
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!




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20097; Package emacs. (Thu, 12 Mar 2015 15:03:01 GMT) Full text and rfc822 format available.

Message #8 received at 20097 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Rasmus <rasmus <at> gmx.us>
Cc: 20097 <at> debbugs.gnu.org
Subject: Re: bug#20097: 25.0.50;
 focus-out-hook doesn't work w/other emacsclient frame
Date: Thu, 12 Mar 2015 11:01:56 -0400
> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20097; Package emacs. (Thu, 12 Mar 2015 15:15:03 GMT) Full text and rfc822 format available.

Message #11 received at 20097 <at> debbugs.gnu.org (full text, mbox):

From: Rasmus <rasmus <at> gmx.us>
To: monnier <at> iro.umontreal.ca
Cc: 20097 <at> debbugs.gnu.org
Subject: Re: bug#20097: 25.0.50;
 focus-out-hook doesn't work w/other emacsclient frame
Date: Thu, 12 Mar 2015 16:14:13 +0100
Stefan Monnier <monnier <at> 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!




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20097; Package emacs. (Wed, 15 Jan 2020 05:31:02 GMT) Full text and rfc822 format available.

Message #14 received at 20097 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Rasmus <rasmus <at> gmx.us>
Cc: monnier <at> iro.umontreal.ca, 20097 <at> debbugs.gnu.org
Subject: Re: bug#20097: 25.0.50; focus-out-hook doesn't work w/other
 emacsclient frame
Date: Wed, 15 Jan 2020 06:30:44 +0100
Rasmus <rasmus <at> gmx.us> writes:

> Stefan Monnier <monnier <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20097; Package emacs. (Wed, 15 Jan 2020 14:04:02 GMT) Full text and rfc822 format available.

Message #17 received at 20097 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 20097 <at> debbugs.gnu.org, Rasmus <rasmus <at> gmx.us>
Subject: Re: bug#20097: 25.0.50; focus-out-hook doesn't work w/other
 emacsclient frame
Date: Wed, 15 Jan 2020 09:03:37 -0500
> 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





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20097; Package emacs. (Wed, 15 Jan 2020 18:17:01 GMT) Full text and rfc822 format available.

Message #20 received at 20097 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 20097 <at> debbugs.gnu.org, Rasmus <rasmus <at> gmx.us>
Subject: Re: bug#20097: 25.0.50; focus-out-hook doesn't work w/other
 emacsclient frame
Date: Wed, 15 Jan 2020 19:16:44 +0100
Stefan Monnier <monnier <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20097; Package emacs. (Wed, 15 Jan 2020 19:09:01 GMT) Full text and rfc822 format available.

Message #23 received at 20097 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 20097 <at> debbugs.gnu.org, Rasmus <rasmus <at> gmx.us>
Subject: Re: bug#20097: 25.0.50; focus-out-hook doesn't work w/other
 emacsclient frame
Date: Wed, 15 Jan 2020 14:08:19 -0500
> 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





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20097; Package emacs. (Wed, 15 Jan 2020 19:17:02 GMT) Full text and rfc822 format available.

Message #26 received at 20097 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 20097 <at> debbugs.gnu.org, Rasmus <rasmus <at> gmx.us>
Subject: Re: bug#20097: 25.0.50; focus-out-hook doesn't work w/other
 emacsclient frame
Date: Wed, 15 Jan 2020 20:16:07 +0100
retitle 20097 Add new hook to be run when switching frames
thanks

Stefan Monnier <monnier <at> 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




Changed bug title to 'Add new hook to be run when switching frames' from '25.0.50; focus-out-hook doesn't work w/other emacsclient frame' Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Wed, 15 Jan 2020 19:17:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20097; Package emacs. (Wed, 15 Jan 2020 19:51:02 GMT) Full text and rfc822 format available.

Message #31 received at 20097 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 20097 <at> debbugs.gnu.org, Rasmus <rasmus <at> gmx.us>
Subject: Re: bug#20097: 25.0.50; focus-out-hook doesn't work w/other
 emacsclient frame
Date: Wed, 15 Jan 2020 14:50:07 -0500
> 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





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20097; Package emacs. (Wed, 15 Jan 2020 20:19:02 GMT) Full text and rfc822 format available.

Message #34 received at 20097 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 20097 <at> debbugs.gnu.org, Rasmus <rasmus <at> gmx.us>
Subject: Re: bug#20097: 25.0.50; focus-out-hook doesn't work w/other
 emacsclient frame
Date: Wed, 15 Jan 2020 21:18:41 +0100
Stefan Monnier <monnier <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20097; Package emacs. (Sun, 19 Jan 2020 10:16:02 GMT) Full text and rfc822 format available.

Message #37 received at 20097 <at> debbugs.gnu.org (full text, mbox):

From: Rasmus Pank Roulund <rasmus <at> gmx.us>
To: 20097 <at> debbugs.gnu.org
Subject: Re: focus-out-hook doesn't work w/other emacsclient frame
Date: Sun, 19 Jan 2020 11:15:50 +0100
Stefan Kangas <stefan <at> marxist.se> writes:

> Stefan Monnier <monnier <at> 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




Reply sent to Stefan Kangas <stefan <at> marxist.se>:
You have taken responsibility. (Wed, 12 Aug 2020 16:22:02 GMT) Full text and rfc822 format available.

Notification sent to Rasmus <rasmus <at> gmx.us>:
bug acknowledged by developer. (Wed, 12 Aug 2020 16:22:02 GMT) Full text and rfc822 format available.

Message #42 received at 20097-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Rasmus Pank Roulund <rasmus <at> gmx.us>
Cc: 20097-done <at> debbugs.gnu.org
Subject: Re: bug#20097: focus-out-hook doesn't work w/other emacsclient frame
Date: Wed, 12 Aug 2020 09:21:35 -0700
Rasmus Pank Roulund <rasmus <at> 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




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 10 Sep 2020 11:24:15 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 222 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.