GNU bug report logs -
#16436
feature request: select-window-hook
Previous Next
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.
Full log
View this message in rfc822 format
> 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
This bug report was last modified 6 years and 182 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.