|
From: | Juri Linkov |
Subject: | Re: On removing sequence_number from window structure |
Date: | Sun, 10 Feb 2013 11:57:10 +0200 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) |
> Window parameters mean that one has to externally manage some sort of > mechanism to assign unique identifiers (strings or numbers) and run on > `window-configuration-change-hook' first a function to detect for each > split the new parent window and the new live window and assign them > the appropriate values. This is just 10 lines of code: (defvar window-identification-count 0) (defvar window-identification-table (make-hash-table :weakness 'key :test 'eq)) (defun window-identification-update () (walk-windows (lambda (w) (or (gethash w window-identification-table) (puthash w (setq window-identification-count (1+ window-identification-count)) window-identification-table))))) (add-hook 'window-configuration-change-hook 'window-identification-update) (defun mode-line-window-control () (format "-W%s " (or (gethash (selected-window) window-identification-table) ""))) (defvar mode-line-window-identification '(:eval (mode-line-window-control))) (put 'mode-line-window-identification 'risky-local-variable t) ;; Insert between mode-line-frame-identification and mode-line-buffer-identification (setcdr (nthcdr 6 mode-line-format) (cons 'mode-line-window-identification (nthcdr 7 mode-line-format)))
[Prev in Thread] | Current Thread | [Next in Thread] |