emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] master b83b941 65/68: Add `ace-window-display-mode' minor mode


From: Oleh Krehel
Subject: [elpa] master b83b941 65/68: Add `ace-window-display-mode' minor mode
Date: Sat, 21 Mar 2015 19:07:11 +0000

branch: master
commit b83b9417d07d14a8c6559ef6367687590a614997
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    Add `ace-window-display-mode' minor mode
    
    * ace-window.el (ace-window-display-mode): Display the `ace-window' full
      key path in each window.
    (aw-update): New defun. Traverse all windows and set their
    ace-window-path parameter. Some synchronization should be added to
    `aw-select' wrt ignored windows.
---
 ace-window.el |   33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)

diff --git a/ace-window.el b/ace-window.el
index 35e7cb1..815520b 100644
--- a/ace-window.el
+++ b/ace-window.el
@@ -104,7 +104,7 @@ Use M-0 `ace-window' to toggle this value."
 
 (defface aw-mode-line-face
   '((t (:foreground "black")))
-  "Face used for ace window key in the mode-line.")
+  "Face used for displaying the ace window key in the mode-line.")
 
 ;;* Implementation
 (defun aw-ignored-p (window)
@@ -426,6 +426,37 @@ The point is writable, i.e. it's not part of space after 
newline."
         (+ (point) h)))))
 
 ;;* Mode line
+;;;###autoload
+(define-minor-mode ace-window-display-mode
+  "Minor mode for showing the ace window key in the mode line."
+  :global t
+  (if ace-window-display-mode
+      (progn
+        (aw-update)
+        (set-default
+         'mode-line-format
+         `((ace-window-display-mode
+            (:eval (window-parameter (selected-window) 'ace-window-path)))
+           ,@(default-value 'mode-line-format)))
+        (force-mode-line-update t)
+        (add-hook 'window-configuration-change-hook 'aw-update))
+    (set-default
+     'mode-line-format
+     (assq-delete-all
+      'ace-window-display-mode
+      (default-value 'mode-line-format)))
+    (remove-hook 'window-configuration-change-hook 'aw-update)))
+
+(defun aw-update ()
+  "Update ace-window-path window parameter for all windows."
+  (avy-traverse
+   (avy-tree (aw-window-list) aw-keys)
+   (lambda (path leaf)
+     (set-window-parameter
+      leaf 'ace-window-path
+      (propertize
+       (apply #'string (reverse path))
+       'face 'aw-mode-line-face)))))
 
 (provide 'ace-window)
 



reply via email to

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