Function: evil-line-move

evil-line-move is a byte-compiled function defined in evil-common.el.

Signature

(evil-line-move COUNT &optional NOERROR)

Documentation

Like line-move but conserves the column.

Signal an error at buffer boundaries unless NOERROR is non-nil.

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-common.el
(defun evil-line-move (count &optional noerror)
  "Like `line-move' but conserves the column.
Signal an error at buffer boundaries unless NOERROR is non-nil."
  (setq this-command (if (< count 0) 'previous-line 'next-line))
  (let ((last-command
         ;; Reset tmp goal column between visual/logical movement
         (when (or (eq line-move-visual (consp temporary-goal-column))
                   (eq temporary-goal-column most-positive-fixnum))
           last-command))
        (opoint (point)))
    (if (and line-move-visual
             (eq temporary-goal-column most-positive-fixnum)
             (memq last-command '(next-line previous-line)))
        (let (temporary-goal-column) (evil-end-of-visual-line (1+ count)))
      (condition-case err
          (line-move count)
        ((beginning-of-buffer end-of-buffer)
         (let ((col (or goal-column
                        (car-safe temporary-goal-column)
                        temporary-goal-column)))
           (line-move-finish col opoint (< count 0)))
         (or noerror (/= (point) opoint) (signal (car err) (cdr err))))))))