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

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

[elpa] master 47bd115 52/68: Allow customizing the leading char face


From: Oleh Krehel
Subject: [elpa] master 47bd115 52/68: Allow customizing the leading char face
Date: Sat, 21 Mar 2015 19:07:06 +0000

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

    Allow customizing the leading char face
    
    * ace-window.el (aw-leading-char-face): New face.
    (aw-keys):
    (aw-ignore-on):
    (aw-background):
    (aw-scope): No need for :group.
    (aw-ignored-buffers): Add type.
    (ace-window-end-hook): Remove deprecated var.
    (ace-window-end-once-hook): Remove deprecated var.
    (aw-select): Inline `ace-jump-populate-overlay-to-search-tree'.
    
    Fixes #19.
    
    Example of customization:
    
    (custom-set-faces
     '(aw-leading-char-face
       ((t (:inherit ace-jump-face-foreground :height 2.0)))))
    
    You can customize interactively with "M-x" `customize-group'
    `ace-window'.
---
 ace-window.el |   51 ++++++++++++++++++++++++++++-----------------------
 1 files changed, 28 insertions(+), 23 deletions(-)

diff --git a/ace-window.el b/ace-window.el
index af966ff..7185af7 100644
--- a/ace-window.el
+++ b/ace-window.el
@@ -69,43 +69,30 @@
   :prefix "aw-")
 
 (defcustom aw-keys '(?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9)
-  "Keys for selecting window."
-  :group 'ace-window)
+  "Keys for selecting window.")
 
 (defcustom aw-scope 'global
   "The scope used by `ace-window'."
-  :group 'ace-window
   :type '(choice
           (const :tag "global" global)
           (const :tag "frame" frame)))
 
 (defcustom aw-ignored-buffers '("*Calc Trail*" "*LV*")
   "List of buffers to ignore when selecting window."
-  :group 'ace-window)
+  :type '(repeat string))
 
 (defcustom aw-ignore-on t
   "When t, `ace-window' will ignore `aw-ignored-buffers'.
 Use M-0 `ace-window' to toggle this value."
-  :type 'boolean
-  :group 'ace-window)
+  :type 'boolean)
 
 (defcustom aw-background t
   "When t, `ace-window' will dim out all buffers temporarily when used.'."
-  :type 'boolean
-  :group 'ace-window)
-
-(defvar ace-window-end-hook nil
-  "Function(s) to call after `ace-window' is done.")
-(make-obsolete-variable
- 'ace-window-end-hook
- "Don't use `ace-window-end-hook', just call what you need right after 
`ace-window'" "0.7.0")
-
-(defvar ace-window-end-once-hook nil
-  "Function(s) to call once after `ace-window' is done.
-This hook is set to nil with each call to `ace-window'.")
-(make-obsolete-variable
- 'ace-window-end-once-hook
- "Don't use `ace-window-end-once-hook', just call what you need right after 
`ace-window'" "0.7.0")
+  :type 'boolean)
+
+(defface aw-leading-char-face
+    '((t (:inherit ace-jump-face-foreground)))
+  "Face for each window's leading char.")
 
 (defun aw-ignored-p (window)
   "Return t if WINDOW should be ignored."
@@ -199,8 +186,26 @@ Amend MODE-LINE to the mode line for the duration of the 
selection."
                (ace-jump-tree-breadth-first-construct
                 (length candidate-list)
                 (length aw-keys)))
-         (ace-jump-populate-overlay-to-search-tree
-          ace-jump-search-tree candidate-list)
+         (let ((s (list ace-jump-search-tree)))
+           (while s
+             (let ((node (pop s)))
+               (cond
+                 ((eq (car node) 'branch)
+                  ;; push all child node into stack
+                  (setq s (append (cdr node) s)))
+                 ((eq (car node) 'leaf)
+                  (let* ((p (pop candidate-list))
+                         (o (aj-position-offset p))
+                         (ol (make-overlay
+                              o (1+ o)
+                              (aj-position-buffer p))))
+                    ;; update leaf node to remember the ol
+                    (setf (cdr node) ol)
+                    (overlay-put ol 'face 'aw-leading-char-face)
+                    (overlay-put ol 'window (aj-position-window p))
+                    (overlay-put ol 'aj-data p)))
+                 (t
+                  (message "Failure in traversal"))))))
          (ace-jump-update-overlay-in-search-tree
           ace-jump-search-tree aw-keys)
          (setq ace-jump-mode mode-line)



reply via email to

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