GNU bug report logs - #16436
feature request: select-window-hook

Previous Next

Package: emacs;

Reported by: 陈育龙 <chenyulong1 <at> gmail.com>

Date: Tue, 14 Jan 2014 04:56:02 UTC

Severity: wishlist

Merged with 7381

Found in version 24.0.50

Fixed in version 27.1

Done: Glenn Morris <rgm <at> gnu.org>

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 16436 in the body.
You can then email your comments to 16436 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#16436; Package emacs. (Tue, 14 Jan 2014 04:56:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to 陈育龙 <chenyulong1 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 14 Jan 2014 04:56:03 GMT) Full text and rfc822 format available.

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

From: 陈育龙 <chenyulong1 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: feature request: select-window-hook
Date: Tue, 14 Jan 2014 11:48:29 +0800
[Message part 1 (text/plain, inline)]
I don't know whether I missed something but I can't find a hook like
select-window-hook in stand
hooks<http://www.gnu.org/software/emacs/manual/html_node/elisp/Standard-Hooks.html>,
and I find some other emacs user has the same issue.

I really want to have a function as select-last-window for emacs, by now, I
hack it in a ugly way, and I think select-window-hook can make it better.

Thanks.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16436; Package emacs. (Tue, 14 Jan 2014 07:48:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: 陈育龙 <chenyulong1 <at> gmail.com>
Cc: 16436 <at> debbugs.gnu.org
Subject: Re: bug#16436: feature request: select-window-hook
Date: Tue, 14 Jan 2014 08:47:11 +0100
> I don't know whether I missed something but I can't find a hook like
> select-window-hook in stand
> hooks<http://www.gnu.org/software/emacs/manual/html_node/elisp/Standard-Hooks.html>,
> and I find some other emacs user has the same issue.
>
> I really want to have a function as select-last-window for emacs, by now, I
> hack it in a ugly way, and I think select-window-hook can make it better.

Try

(defvar my-window nil)
(defvar my-last-window nil)

(defun my-last-window ()
  (unless (or (window-minibuffer-p)
	      (eq (selected-window) my-window))
    (setq my-last-window my-window)
    (setq my-window (selected-window))))

(add-hook 'buffer-list-update-hook 'my-last-window)

(defun select-last-window ()
  (interactive)
  (when (and (window-live-p my-last-window)
	     (not (eq my-last-window (selected-window))))
    (select-window my-last-window)))

martin




Merged 7381 16436. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 17 Jan 2014 00:06:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16436; Package emacs. (Sat, 12 Jan 2019 09:16:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: 陈育龙 <chenyulong1 <at> gmail.com>, 
 16436 <at> debbugs.gnu.org
Subject: Re: bug#16436: feature request: select-window-hook
Date: Sat, 12 Jan 2019 10:15:39 +0100
> I don't know whether I missed something but I can't find a hook like
> select-window-hook in stand
> hooks<http://www.gnu.org/software/emacs/manual/html_node/elisp/Standard-Hooks.html>,
> and I find some other emacs user has the same issue.
>
> I really want to have a function as select-last-window for emacs, by now, I
> hack it in a ugly way, and I think select-window-hook can make it better.

Emacs now provides a hook called 'window-selection-change-functions'
which should fix your problem.  Please have a look.

Thanks, martin




bug Marked as fixed in versions 27.1. Request was from martin rudalics <rudalics <at> gmx.at> to control <at> debbugs.gnu.org. (Sat, 12 Jan 2019 09:24:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 7381 <at> debbugs.gnu.org and Štěpán Němec <stepnem <at> gmail.com> Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 12 Jan 2019 18:54:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 10 Feb 2019 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 76 days ago.

Previous Next


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