emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: require-hard-newlines to use newline


From: Chong Yidong
Subject: Re: require-hard-newlines to use newline
Date: Sat, 5 Mar 2005 21:18:49 -0500 (EST)
User-agent: SquirrelMail/1.4.4

>     I don't think there's a problem in this situation; he just has to make
>     sure that point is before the final (hard) newline before he continues
>     editing.
>
> If the user has to do that, then why does it matter whether this
> newline is hard or soft?

Because, everywhere else in the buffer, the newline at the end of a
paragraph is hard.

To forestall this discussion going round in a circle again: one might
object that the newline at the end of the last paragraph need not be hard,
because the user may not have decided to end that paragraph yet. But
that's okay, because eventually he *has* to end that paragraph (that's
what require-final-newline says). Because the final newline is inserted in
a save-excursion, after point, there is never any inconvenience to the
user.

I will have one last try at illustrating why using a soft newline can lead
to strange behavior. If this does not work, then I will simply drop the
issue.

Consider this, scenario A:

emacs -Q
M-x use-hard-newline
M-: (setq require-final-newline t)
C-x C-f foo.txt
some text
C-x C-s

And consider another scenario, scenario B, which is the same except the
user explicitly types in a newline before C-x C-s ("some text RET").

Now suppose the user goes to another buffer to do his editing, and comes
back to this buffer a long time later. He does not remember the exact
sequence of edits he performed on that buffer -- in particular, whether he
typed RET or not. From moving point around, he observes that the buffer
contains "some text" followed by a final newline.

Now suppose he does this:

M->
some more text
M-q

There is a big difference! In scenario A, M-q causes moves "some more
text" onto the same line as "some text". In scenario B, nothing happens
(which is correct, because the purpose of use-hard-newlines is to allow a
hard break in the middle of a sentence.) This leads to an appearance of
unpredictability.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]