branch: externals/window-commander
commit a816f208e9b2fc748415684bd401c262b4312a77
Author: Daniel Semyonov <[email protected]>
Commit: Daniel Semyonov <[email protected]>
Simplify the format of 'swsw-window-list'
Use an alist instead of a plist to store window information;
accomplish this by not saving the (currently unused) buffer associated
with the ID.
* swsw.el (swsw-window-list): Update docstring.
(swsw-update): Create new elements of 'swsw-window-list' as cons
cells, disregarding the buffer corresponding to the window.
(swsw-select): Use 'assq' instead of 'plist-get' to get the window
associated with an ID.
---
swsw.el | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/swsw.el b/swsw.el
index 7dc791d6f0..cd0c4022c8 100644
--- a/swsw.el
+++ b/swsw.el
@@ -46,7 +46,7 @@
"Characters from which window IDs can currently be constructed.")
(defvar swsw-window-list nil
- "List of active window plists.")
+ "Alist of active active windows and their IDs.")
(defun swsw-reset ()
"Reset information for all windows."
@@ -57,10 +57,7 @@
"Update information for WINDOW."
(let ((id (pop swsw-id-chars)))
(when id
- (push (list
- id
- :window window
- :buffer (window-buffer window))
+ (push (cons id window)
swsw-window-list)
(set-window-parameter window 'swsw-id id))))
@@ -101,9 +98,8 @@ line update for all windows."
(interactive (unless (< (length swsw-window-list) 3)
(list (read-char))))
(if id
- (let (window)
- (when (setq
- window (plist-get (cdr (assq id swsw-window-list)) :window))
+ (let ((window (cdr (assq id swsw-window-list))))
+ (when window
(select-window window)))
(other-window 1)))