;;; Code:
;;* Requires
+(require 'cl-lib)
(require 'avy)
;;* Customization
(defun avy--process (candidates overlay-fn)
"Select one of CANDIDATES using `avy-read'."
(unwind-protect
- (cl-case (length candidates)
- (0
- nil)
- (1
- (car candidates))
- (t
- (avy--make-backgrounds (list (selected-window)))
- (avy-read (avy-tree candidates avy-keys)
- overlay-fn
- #'avy--remove-leading-chars)))
+ (cl-case (length candidates)
+ (0
+ nil)
+ (1
+ (car candidates))
+ (t
+ (avy--make-backgrounds (list (selected-window)))
+ (avy-read (avy-tree candidates avy-keys)
+ overlay-fn
+ #'avy--remove-leading-chars)))
(avy--done)))
(defvar avy--overlays-back nil
"Create an overlay with STR at PT in WND."
(when (<= (1+ pt) (with-selected-window wnd (point-max)))
(let* ((pt (+ pt avy--overlay-offset))
- (ol (make-overlay pt (1+ pt) (window-buffer wnd)))
- (old-str (with-selected-window wnd
- (buffer-substring pt (1+ pt)))))
+ (ol (make-overlay pt (1+ pt) (window-buffer wnd)))
+ (old-str (with-selected-window wnd
+ (buffer-substring pt (1+ pt)))))
(when avy-background
- (setq old-str (propertize
- old-str 'face 'avy-background-face)))
+ (setq old-str (propertize
+ old-str 'face 'avy-background-face)))
(overlay-put ol 'window wnd)
(overlay-put ol 'display (concat str old-str))
(push ol avy--overlays-lead))))
old-str 'face 'avy-background-face)))
(overlay-put ol 'window wnd)
(overlay-put ol 'display (if (string= old-str "\n")
- (concat str "\n")
- str))
+ (concat str "\n")
+ str))
(push ol avy--overlays-lead))))
(defun avy--overlay-post (path leaf)
(avy--generic-jump
(let ((c (read-char "char: ")))
(if (= 13 c)
- "\n"
+ "\n"
(regexp-quote (string c))))
arg
avy-goto-char-style))
(interactive "P")
(avy--generic-jump
(regexp-quote (string
- (read-char "char 1: ")
- (read-char "char 2: ")))
+ (read-char "char 1: ")
+ (read-char "char 2: ")))
arg
avy-goto-char-style))