Function: line-end-position
line-end-position is a function defined in editfns.c.
Signature
(line-end-position &optional N)
Documentation
Return the character position of the last character on the current line.
With argument N not nil or 1, move forward N - 1 lines first. If scan reaches end of buffer, return that position.
This function ignores text display directionality; it returns the position of the last character in logical order, i.e. the largest character position on the line.
This function constrains the returned position to the current field
unless that would be on a different line from the original,
unconstrained result. If N is nil or 1, and a rear-sticky field ends
at point, the scan stops as soon as it starts. To ignore field
boundaries bind inhibit-field-text-motion to t.
This function does not move point.
Other relevant functions are documented in the buffer group.
Probably introduced at or before Emacs version 20.4.
Shortdoc
;; buffer
(line-end-position)
=> 125
Aliases
hashcash-point-at-eol (obsolete since 28.1)
point-at-eol
mh-line-end-position
Source Code
// Defined in /usr/src/emacs/src/editfns.c
{
ptrdiff_t clipped_n;
ptrdiff_t end_pos;
ptrdiff_t orig = PT;
if (NILP (n))
clipped_n = 1;
else if (FIXNUMP (n))
clipped_n = clip_to_bounds (-BUF_BYTES_MAX, XFIXNUM (n), BUF_BYTES_MAX);
else
{
CHECK_INTEGER (n);
clipped_n = NILP (Fnatnump (n)) ? -BUF_BYTES_MAX : BUF_BYTES_MAX;
}
end_pos = find_before_next_newline (orig, 0, clipped_n - (clipped_n <= 0),
NULL);
/* Return END_POS constrained to the current input field. */
return Fconstrain_to_field (make_fixnum (end_pos), make_fixnum (orig),
Qnil, Qt, Qnil);
}