From: martin rudalics <rudalics@gmx.at>
To: 陈育龙 <chenyulong1@gmail.com>
Cc: 16436@debbugs.gnu.org
Subject: bug#16436: feature request: select-window-hook
Date: Tue, 14 Jan 2014 08:47:11 +0100 [thread overview]
Message-ID: <52D4EB7F.7080004@gmx.at> (raw)
In-Reply-To: <CAPObjnd+-NkD4s5rPmBBfvBsbsM2vQJ3CH_2ejx6NO9fwZvdvw@mail.gmail.com>
> 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
next prev parent reply other threads:[~2014-01-14 7:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-14 3:48 bug#16436: feature request: select-window-hook 陈育龙
2014-01-14 7:47 ` martin rudalics [this message]
2019-01-12 9:15 ` martin rudalics
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52D4EB7F.7080004@gmx.at \
--to=rudalics@gmx.at \
--cc=16436@debbugs.gnu.org \
--cc=chenyulong1@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.