mirror of
https://github.com/abo-abo/avy.git
synced 2025-10-13 13:33:03 +00:00
avy.el (avy-goto-line): Allow numeric prefix arg
The old behavior remains for ARG 1 and 4. For all other ARG, simply go to that line. Fixes #86
This commit is contained in:
parent
53d457cfe4
commit
ed120ea164
19
avy.el
19
avy.el
@ -935,8 +935,19 @@ The window scope is determined by `avy-all-windows' (ARG negates it)."
|
|||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun avy-goto-line (&optional arg)
|
(defun avy-goto-line (&optional arg)
|
||||||
"Jump to a line start in current buffer.
|
"Jump to a line start in current buffer.
|
||||||
The window scope is determined by `avy-all-windows' (ARG negates it)."
|
|
||||||
(interactive "P")
|
When ARG is 1, jump to lines currently visible, with the option
|
||||||
|
to cancel to `goto-line' by entering a number.
|
||||||
|
|
||||||
|
When ARG is 4, negate the window scope determined by
|
||||||
|
`avy-all-windows'.
|
||||||
|
|
||||||
|
Otherwise, forward to `goto-line' with ARG."
|
||||||
|
(interactive "p")
|
||||||
|
(if (not (memq arg '(1 4)))
|
||||||
|
(progn
|
||||||
|
(goto-char (point-min))
|
||||||
|
(forward-line arg))
|
||||||
(avy-with avy-goto-line
|
(avy-with avy-goto-line
|
||||||
(let* ((avy-handler-function
|
(let* ((avy-handler-function
|
||||||
(lambda (char)
|
(lambda (char)
|
||||||
@ -950,9 +961,9 @@ The window scope is determined by `avy-all-windows' (ARG negates it)."
|
|||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(forward-line (1- (string-to-number line)))
|
(forward-line (1- (string-to-number line)))
|
||||||
(throw 'done 'exit))))))
|
(throw 'done 'exit))))))
|
||||||
(r (avy--line arg)))
|
(r (avy--line (eq arg 4))))
|
||||||
(unless (eq r t)
|
(unless (eq r t)
|
||||||
(avy-action-goto r)))))
|
(avy-action-goto r))))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun avy-copy-line (arg)
|
(defun avy-copy-line (arg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user