Function: consult-goto-line

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

Signature

(consult-goto-line &optional ARG)

Documentation

Read line number and jump to the line with preview.

Enter either a line number to jump to the first column of the given line or line:column in order to jump to a specific column. Jump directly if a line number is given as prefix ARG. The command respects narrowing and the settings consult-goto-line-numbers and consult-line-numbers-widen.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/consult-20260805.1130/consult.el
;;;###autoload
(defun consult-goto-line (&optional arg)
  "Read line number and jump to the line with preview.

Enter either a line number to jump to the first column of the
given line or line:column in order to jump to a specific column.
Jump directly if a line number is given as prefix ARG.  The
command respects narrowing and the settings
`consult-goto-line-numbers' and `consult-line-numbers-widen'."
  (interactive "P")
  (if arg
      (call-interactively #'goto-line)
    (consult--forbid-minibuffer)
    (consult--local-let ((display-line-numbers consult-goto-line-numbers)
                         (display-line-numbers-widen consult-line-numbers-widen))
      (while (if-let* ((pos (consult--goto-line-position
                             (consult--prompt
                              :prompt "Go to line: "
                              :history 'goto-line-history
                              :state
                              (let ((preview (consult--jump-preview)))
                                (lambda (action str)
                                  (funcall preview action
                                           (consult--goto-line-position str #'ignore)))))
                             #'consult--minibuffer-message)))
                 (consult--jump pos)
               t)))))