]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/ace-window/ace-window.el
Merge commit 'b114cf8a93224c85c51e95db52bf359131130476' from ace-window
[gnu-emacs-elpa] / packages / ace-window / ace-window.el
index 68e28cfffc83b67447e1311f88051c843db3c793..791b34d0d1625e5aab9f94079d952b2f98772e6b 100644 (file)
@@ -5,7 +5,8 @@
 ;; Author: Oleh Krehel <ohwoeowho@gmail.com>
 ;; Maintainer: Oleh Krehel <ohwoeowho@gmail.com>
 ;; URL: https://github.com/abo-abo/ace-window
-;; Version: 0.8.0
+;; Version: 0.8.1
+;; Package-Requires: ((avy "0.1.0"))
 ;; Keywords: window, location
 
 ;; This file is part of GNU Emacs.
@@ -59,7 +60,7 @@
 ;; deleted instead.
 
 ;;; Code:
-(require 'avy)
+(require 'avy-jump)
 (require 'ring)
 
 ;;* Customization
 Use M-0 `ace-window' to toggle this value."
   :type 'boolean)
 
+(defcustom aw-ignore-current nil
+  "When t, `ace-window' will ignore `selected-window'."
+  :type 'boolean)
+
 (defcustom aw-background t
   "When t, `ace-window' will dim out all buffers temporarily when used.'."
   :type 'boolean)
@@ -114,9 +119,11 @@ Use M-0 `ace-window' to toggle this value."
 ;;* Implementation
 (defun aw-ignored-p (window)
   "Return t if WINDOW should be ignored."
-  (and aw-ignore-on
-       (member (buffer-name (window-buffer window))
-               aw-ignored-buffers)))
+  (or (and aw-ignore-on
+           (member (buffer-name (window-buffer window))
+                   aw-ignored-buffers))
+      (and aw-ignore-current
+           (equal window (selected-window)))))
 
 (defun aw-window-list ()
   "Return the list of interesting windows."
@@ -141,9 +148,6 @@ Use M-0 `ace-window' to toggle this value."
        (error "Invalid `aw-scope': %S" aw-scope))))
    'aw-window<))
 
-(defvar aw-overlays-lead nil
-  "Hold overlays for leading chars.")
-
 (defvar aw-overlays-back nil
   "Hold overlays for when `aw-background' is t.")
 
@@ -163,7 +167,7 @@ Use M-0 `ace-window' to toggle this value."
   ;; background
   (mapc #'delete-overlay aw-overlays-back)
   (setq aw-overlays-back nil)
-  (aw--remove-leading-chars))
+  (avy--remove-leading-chars))
 
 (defun aw--lead-overlay (path leaf)
   "Create an overlay using PATH at LEAF.
@@ -197,12 +201,7 @@ LEAF is (PT . WND)."
     (overlay-put ol 'face 'aw-leading-char-face)
     (overlay-put ol 'window wnd)
     (overlay-put ol 'display new-str)
-    (push ol aw-overlays-lead)))
-
-(defun aw--remove-leading-chars ()
-  "Remove leading char overlays."
-  (mapc #'delete-overlay aw-overlays-lead)
-  (setq aw-overlays-lead nil))
+    (push ol avy--overlays-lead)))
 
 (defun aw--make-backgrounds (wnd-list)
   "Create a dim background overlay for each window on WND-LIST."
@@ -265,7 +264,7 @@ Amend MODE-LINE to the mode line for the duration of the selection."
               (condition-case err
                   (or (cdr (avy-read (avy-tree candidate-list aw-keys)
                                      #'aw--lead-overlay
-                                     #'aw--remove-leading-chars))
+                                     #'avy--remove-leading-chars))
                       start-window)
                 (error
                  (if (memq (nth 2 err) aw--flip-keys)