Function: avy-goto-line

avy-goto-line is an autoloaded, interactive and byte-compiled function defined in avy.el.

Signature

(avy-goto-line &optional ARG)

Documentation

Jump to a line start in current buffer.

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.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/avy-20241101.1357/avy.el
;;;###autoload
(defun avy-goto-line (&optional arg)
  "Jump to a line start in current buffer.

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")
  (setq arg (or arg 1))
  (if (not (memq arg '(1 4)))
      (progn
        (goto-char (point-min))
        (forward-line (1- arg)))
    (avy-with avy-goto-line
      (let* ((avy-handler-old avy-handler-function)
             (avy-handler-function
              (lambda (char)
                (if (or (< char ?0)
                        (> char ?9))
                    (funcall avy-handler-old char)
                  (let ((line (read-from-minibuffer
                               "Goto line: " (string char))))
                    (when line
                      (avy-push-mark)
                      (save-restriction
                        (widen)
                        (goto-char (point-min))
                        (forward-line (1- (string-to-number line))))
                      (throw 'done 'exit))))))
             (r (avy--line (eq arg 4))))
        (when (and (not (memq r '(t nil))) (eq avy-action #'identity))
          (avy-action-goto r))))))