mirror of
https://github.com/abo-abo/avy.git
synced 2025-10-12 21:13:04 +00:00
parent
c32b91fa32
commit
6ff26f5377
5
.dir-locals.el
Normal file
5
.dir-locals.el
Normal file
@ -0,0 +1,5 @@
|
||||
;;; Directory Local Variables
|
||||
;;; For more information see (info "(emacs) Directory Variables")
|
||||
|
||||
((emacs-lisp-mode
|
||||
(indent-tabs-mode . nil)))
|
41
avy-jump.el
41
avy-jump.el
@ -29,6 +29,7 @@
|
||||
|
||||
;;; Code:
|
||||
;;* Requires
|
||||
(require 'cl-lib)
|
||||
(require 'avy)
|
||||
|
||||
;;* Customization
|
||||
@ -95,16 +96,16 @@ POS is either a position or (BEG . END)."
|
||||
(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
|
||||
@ -162,12 +163,12 @@ When PRED is non-nil, it's a filter for matching point positions."
|
||||
"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))))
|
||||
@ -209,8 +210,8 @@ LEAF is ((BEG . END) . WND)."
|
||||
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)
|
||||
@ -274,7 +275,7 @@ The window scope is determined by `avy-all-windows' (ARG negates it)."
|
||||
(avy--generic-jump
|
||||
(let ((c (read-char "char: ")))
|
||||
(if (= 13 c)
|
||||
"\n"
|
||||
"\n"
|
||||
(regexp-quote (string c))))
|
||||
arg
|
||||
avy-goto-char-style))
|
||||
@ -286,8 +287,8 @@ The window scope is determined by `avy-all-windows' (ARG negates it)."
|
||||
(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))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user