Function: next-line
next-line is an interactive and byte-compiled function defined in
simple.el.gz.
Signature
(next-line &optional ARG TRY-VSCROLL)
Documentation
Move cursor vertically down ARG lines.
Interactively, vscroll tall lines if auto-window-vscroll is enabled.
Non-interactively, use TRY-VSCROLL to control whether to vscroll tall
lines: if either auto-window-vscroll or TRY-VSCROLL is nil, this
function will not vscroll.
ARG defaults to 1.
If there is no character in the target line exactly under the current column,
the cursor is positioned after the character in that line that spans this
column, or at the end of the line if it is not long enough.
If there is no line in the buffer after this one, behavior depends on the
value of next-line-add-newlines. If non-nil, it inserts a newline character
to create a line, and moves the cursor to that line. Otherwise it moves the
cursor to the end of the buffer.
If the variable line-move-visual(var)/line-move-visual(fun) is non-nil, this command moves
by display lines. Otherwise, it moves by buffer lines, without
taking variable-width characters or continued lines into account.
See M-x next-logical-line (next-logical-line) for a command that always moves by buffer lines.
The command C-x C-n (set-goal-column) can be used to create
a semipermanent goal column for this command.
Then instead of trying to move exactly vertically (or as close as possible),
this command moves to the specified goal column (or as close as possible).
The goal column is stored in the variable goal-column, which is nil
when there is no goal column. Note that setting goal-column
overrides line-move-visual(var)/line-move-visual(fun) and causes this command to move by buffer
lines rather than by display lines.
Probably introduced at or before Emacs version 16.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/simple.el.gz
(defun next-line (&optional arg try-vscroll)
"Move cursor vertically down ARG lines.
Interactively, vscroll tall lines if `auto-window-vscroll' is enabled.
Non-interactively, use TRY-VSCROLL to control whether to vscroll tall
lines: if either `auto-window-vscroll' or TRY-VSCROLL is nil, this
function will not vscroll.
ARG defaults to 1.
If there is no character in the target line exactly under the current column,
the cursor is positioned after the character in that line that spans this
column, or at the end of the line if it is not long enough.
If there is no line in the buffer after this one, behavior depends on the
value of `next-line-add-newlines'. If non-nil, it inserts a newline character
to create a line, and moves the cursor to that line. Otherwise it moves the
cursor to the end of the buffer.
If the variable `line-move-visual' is non-nil, this command moves
by display lines. Otherwise, it moves by buffer lines, without
taking variable-width characters or continued lines into account.
See \\[next-logical-line] for a command that always moves by buffer lines.
The command \\[set-goal-column] can be used to create
a semipermanent goal column for this command.
Then instead of trying to move exactly vertically (or as close as possible),
this command moves to the specified goal column (or as close as possible).
The goal column is stored in the variable `goal-column', which is nil
when there is no goal column. Note that setting `goal-column'
overrides `line-move-visual' and causes this command to move by buffer
lines rather than by display lines."
(declare (interactive-only forward-line))
(interactive "^p\np")
(or arg (setq arg 1))
(if (and next-line-add-newlines (= arg 1))
(if (save-excursion (end-of-line) (eobp))
;; When adding a newline, don't expand an abbrev.
(let ((abbrev-mode nil))
(end-of-line)
(insert (if use-hard-newlines hard-newline "\n")))
(line-move arg nil nil try-vscroll))
(if (called-interactively-p 'interactive)
(condition-case err
(line-move arg nil nil try-vscroll)
((beginning-of-buffer end-of-buffer)
(signal (car err) (cdr err))))
(line-move arg nil nil try-vscroll)))
nil)