* move-end-of-line vs just search for newline char?
@ 2010-03-09 17:01 Xah Lee
2010-03-09 20:27 ` Uday S Reddy
2010-03-11 8:37 ` Alan Mackenzie
0 siblings, 2 replies; 4+ messages in thread
From: Xah Lee @ 2010-03-09 17:01 UTC (permalink / raw)
To: help-gnu-emacs
There's the move-end-of-line function. The source code and doc seems a
bit complicated.
my question is, what's the difference if i just call
(search-forward "\n")
(backward-char 1)
Thanks.
Xah
∑ http://xahlee.org/
☄
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: move-end-of-line vs just search for newline char?
2010-03-09 17:01 move-end-of-line vs just search for newline char? Xah Lee
@ 2010-03-09 20:27 ` Uday S Reddy
2010-03-09 21:38 ` Xah Lee
2010-03-11 8:37 ` Alan Mackenzie
1 sibling, 1 reply; 4+ messages in thread
From: Uday S Reddy @ 2010-03-09 20:27 UTC (permalink / raw)
To: help-gnu-emacs
Xah Lee wrote:
> There's the move-end-of-line function. The source code and doc seems a
> bit complicated.
>
> my question is, what's the difference if i just call
>
> (search-forward "\n")
> (backward-char 1)
I think (end-of-line 1) is the preferred way of going to the end of line.
move-end-of-line is an interactive command and it has to take care of various stuff. Your alternative might not work in a CRLF line-ending format or if there is no newline at the end of the buffer.
Cheers,
Uday
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: move-end-of-line vs just search for newline char?
2010-03-09 20:27 ` Uday S Reddy
@ 2010-03-09 21:38 ` Xah Lee
0 siblings, 0 replies; 4+ messages in thread
From: Xah Lee @ 2010-03-09 21:38 UTC (permalink / raw)
To: help-gnu-emacs
On Mar 9, 12:27 pm, Uday S Reddy <uDOTsDOTre...@cs.bham.ac.uk> wrote:
> Xah Lee wrote:
> > There's the move-end-of-line function. The source code and doc seems a
> > bit complicated.
>
> > my question is, what's the difference if i just call
>
> > (search-forward "\n")
> > (backward-char 1)
> I think (end-of-line 1) is the preferred way of going to the end of line.
> move-end-of-line is an interactive command and it has to take care
> of various stuff.
Thanks. good answer.
> Your alternative might not work in a CRLF line-ending format or if
> there is no newline at the end of the buffer.
this shouldn't matter though because in buffer, newline char is always
represented by "\n". End of buffer problem is a good one still, i
think.
Xah
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: move-end-of-line vs just search for newline char?
2010-03-09 17:01 move-end-of-line vs just search for newline char? Xah Lee
2010-03-09 20:27 ` Uday S Reddy
@ 2010-03-11 8:37 ` Alan Mackenzie
1 sibling, 0 replies; 4+ messages in thread
From: Alan Mackenzie @ 2010-03-11 8:37 UTC (permalink / raw)
To: help-gnu-emacs
In gnu.emacs.help Xah Lee <xahlee@gmail.com> wrote:
> There's the move-end-of-line function. The source code and doc seems a
> bit complicated.
> my question is, what's the difference if i just call
> (search-forward "\n")
> (backward-char 1)
They'll do different things if point is already at the end of a line.
They'll do different things if a line of text wraps onto two lines on the
screen.
> Thanks.
> Xah
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-03-11 8:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-09 17:01 move-end-of-line vs just search for newline char? Xah Lee
2010-03-09 20:27 ` Uday S Reddy
2010-03-09 21:38 ` Xah Lee
2010-03-11 8:37 ` Alan Mackenzie
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.