duckwork / actually-selected-window.el

tell me what window is actually selected!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

actually-selected-window.el

For the one time you might want to know what window you’ve selected, and not the window select-window reports: when evaluating the mode-line.

I’ll just quote Stefan’s answer from an old Stack Overflow question:

While the mode-line-format is evaluated for a given window, this window is temporarily made the selected-window. In Emacs<=24.3 this was made only halfway: selected-window was changed, but not frame-selected-window. This meant that temporarily (frame-selected-window) was not equal to (selected-window) and breaking this (normally) invariant was a source of various corner case bugs. So we fixed it in 24.4, which means that your code broke.

I took some code from another answer to that question, and code from this blog post from Occasionally Cogent, and wrapped it up in a mode. Simple.

Installation

Clone this repository and put it in your load-path somewhere, then require as normal.

Usage

  1. Enable actually-selected-window-mode in your init file.
  2. In your modeline, or wherever you need to know what window is actually selected (i.e., selected by the user), call actually-selected-window-p.

Contributing

Pull requests and issues, as always, are welcome!

License

This package is licensed under the terms of the GNU General Public License, version 3. See LICENSE for the full text.

About

tell me what window is actually selected!

License:GNU General Public License v3.0


Languages

Language:Emacs Lisp 100.0%