branch: master commit 909483e104a2decf69d27fba8662100c57353fe4 Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
avy.el (avy--process): Make `overlay-fn' arg optional --- avy.el | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/avy.el b/avy.el index f5110fd..eb48403 100644 --- a/avy.el +++ b/avy.el @@ -787,9 +787,10 @@ Set `avy-style' according to COMMMAND as well." #'avy--remove-leading-chars)))) (avy--done)))))) -(defun avy--process (candidates overlay-fn) +(defun avy--process (candidates &optional overlay-fn) "Select one of CANDIDATES using `avy-read'. Use OVERLAY-FN to visualize the decision overlay." + (setq overlay-fn (or overlay-fn (avy--style-fn avy-style))) (unless (and (consp (car candidates)) (windowp (cdar candidates))) (setq candidates @@ -1155,6 +1156,7 @@ exist." (post #'avy--overlay-post) (de-bruijn #'avy--overlay-at-full) (words #'avy--overlay-at-full) + (ignore #'ignore) (t (error "Unexpected style %S" style)))) (defun avy--generic-jump (regex window-flip &optional beg end) @@ -1168,8 +1170,7 @@ BEG and END narrow the scope where candidates are searched." (not avy-all-windows) avy-all-windows))) (avy--process - (avy--regex-candidates regex beg end) - (avy--style-fn style)))) + (avy--regex-candidates regex beg end)))) ;;* Commands ;;;###autoload @@ -1255,8 +1256,7 @@ When ARG is non-nil, do the opposite of `avy-all-windows'." (avy--process (avy--regex-candidates (if isearch-regexp isearch-string - (regexp-quote isearch-string))) - (avy--style-fn avy-style)) + (regexp-quote isearch-string)))) (isearch-done)))) ;;;###autoload @@ -1413,7 +1413,7 @@ BEG and END narrow the scope where candidates are searched." (not (get-char-property (point) 'invisible)) (push (cons (point) (selected-window)) window-cands))) (setq candidates (nconc candidates window-cands)))))) - (avy--process candidates (avy--style-fn avy-style))))) + (avy--process candidates)))) ;;;###autoload (defun avy-goto-subword-1 (char &optional arg) @@ -1566,13 +1566,14 @@ The window scope is determined by `avy-all-windows'. When ARG is non-nil, do the opposite of `avy-all-windows'. BEG and END narrow the scope where candidates are searched. When BOTTOM-UP is non-nil, display avy candidates from top to bottom" - (let ((avy-action #'identity)) + (let ((avy-action #'identity) + (avy-style (if avy-linum-mode + (progn + (message "Goto line:") + 'ignore) + avy-style))) (avy--process - (avy--line-cands arg beg end bottom-up) - (if avy-linum-mode - (progn (message "Goto line:") - 'ignore) - (avy--style-fn avy-style))))) + (avy--line-cands arg beg end bottom-up)))) ;;;###autoload (defun avy-goto-line (&optional arg) @@ -1978,8 +1979,7 @@ The window scope is determined by `avy-all-windows' (ARG negates it)." avy-all-windows))) (avy-with avy-goto-char-timer (avy--process - (avy--read-candidates) - (avy--style-fn avy-style))))) + (avy--read-candidates))))) (defun avy-push-mark () "Store the current point and window." @@ -2047,8 +2047,7 @@ The window scope is determined by `avy-all-windows' (ARG negates it)." (avy--process (avy--read-candidates (lambda (input) - (format "^\\*+ .*\\(%s\\)" input))) - (avy--style-fn avy-style)) + (format "^\\*+ .*\\(%s\\)" input)))) (org-back-to-heading)))) (provide 'avy)