[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#16436: feature request: select-window-hook

From: martin rudalics
Subject: 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
> 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.


(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 ()
  (when (and (window-live-p my-last-window)
             (not (eq my-last-window (selected-window))))
    (select-window my-last-window)))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]