Function: end-of-line

end-of-line is an interactive function defined in cmds.c.

Signature

(end-of-line &optional N)

Documentation

Move point to end of current line (in the logical order).

With argument N not nil or 1, move forward N - 1 lines first. If point reaches the beginning or end of buffer, it stops there. To ignore intangibility, bind inhibit-point-motion-hooks to t.

This function constrains point to the current field unless this moves point to a different line from the original, unconstrained result. If N is nil or 1, and a rear-sticky field ends at point, the point does not move. To ignore field boundaries bind inhibit-field-text-motion to t.

View in manual

Probably introduced at or before Emacs version 19.20.

Key Bindings

Source Code

// Defined in /usr/src/emacs/src/cmds.c
{
  ptrdiff_t newpos;

  if (NILP (n))
    XSETFASTINT (n, 1);
  else
    CHECK_FIXNUM (n);

  while (1)
    {
      newpos = XFIXNUM (Fline_end_position (n));
      SET_PT (newpos);

      if (PT > newpos
	  && FETCH_BYTE (PT_BYTE - 1) == '\n')
	{
	  /* If we skipped over a newline that follows
	     an invisible intangible run,
	     move back to the last tangible position
	     within the line.  */

	  SET_PT (PT - 1);
	  break;
	}
      else if (PT > newpos && PT < ZV
	       && FETCH_BYTE (PT_BYTE) != '\n')
	/* If we skipped something intangible
	   and now we're not really at eol,
	   keep going.  */
	n = make_fixnum (1);
      else
	break;
    }

  return Qnil;
}