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
47
avy.el
47
avy.el
@ -935,24 +935,35 @@ 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
|
||||||
(avy-with avy-goto-line
|
to cancel to `goto-line' by entering a number.
|
||||||
(let* ((avy-handler-function
|
|
||||||
(lambda (char)
|
When ARG is 4, negate the window scope determined by
|
||||||
(if (or (< char ?0)
|
`avy-all-windows'.
|
||||||
(> char ?9))
|
|
||||||
(avy-handler-default char)
|
Otherwise, forward to `goto-line' with ARG."
|
||||||
(let ((line (read-from-minibuffer
|
(interactive "p")
|
||||||
"Goto line: " (string char))))
|
(if (not (memq arg '(1 4)))
|
||||||
(when line
|
(progn
|
||||||
(avy-push-mark)
|
(goto-char (point-min))
|
||||||
(goto-char (point-min))
|
(forward-line arg))
|
||||||
(forward-line (1- (string-to-number line)))
|
(avy-with avy-goto-line
|
||||||
(throw 'done 'exit))))))
|
(let* ((avy-handler-function
|
||||||
(r (avy--line arg)))
|
(lambda (char)
|
||||||
(unless (eq r t)
|
(if (or (< char ?0)
|
||||||
(avy-action-goto r)))))
|
(> char ?9))
|
||||||
|
(avy-handler-default char)
|
||||||
|
(let ((line (read-from-minibuffer
|
||||||
|
"Goto line: " (string char))))
|
||||||
|
(when line
|
||||||
|
(avy-push-mark)
|
||||||
|
(goto-char (point-min))
|
||||||
|
(forward-line (1- (string-to-number line)))
|
||||||
|
(throw 'done 'exit))))))
|
||||||
|
(r (avy--line (eq arg 4))))
|
||||||
|
(unless (eq r t)
|
||||||
|
(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