help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: line adjustment at the end of a sentence


From: T.F. Torrey
Subject: Re: line adjustment at the end of a sentence
Date: Wed, 26 Sep 2012 03:56:44 -0700

Hello Tom,

This same behavior caused me confusion a while back, and it took me a
bit to track it down and get my head around it.  The behavior comes from
Emacs's idea about what ends a sentence.

By default, Emacs expects two spaces after a punctuation mark ending a
sentence.  This comes from the variable sentence-end-double-space, which
has a default value of t, meaning two spaces will appear after the end
of a sentence.  If you set it to nil, you will probably get behavior
closer to what you expect.

In more detail, if I understand it correctly, by default, Emacs expects
punctuation ending sentences to be followed by two spaces or a carriage
return.  When this is the case, using a single space after an
abbreviation such as "Dr. Watson" is significant, because it isn't the
end of a sentence.  It would be wrong to fill the paragraph such that
two spaces appear between "Dr." and "Watson", so the single space must
be preserved.  The line can not be broken between "Dr." and "Watson",
because that would lose the information that it was originally a single
space, and adding text and re-filling the paragraph might put both on
the same line erroneously as two sentences as "Dr.  Watson".  So, in
your example, and in my own experience, Emacs treats the space as
unbreakable, even if the line extends beyond what looks reasonable.  It
may be a bug that it does not break the line before the "Dr." (in this
example), but it could just as easily be a deliberate design.

If you change sentence-end-double-space to nil, then the single space
between "Dr." and "Watson" is no longer significant, and Emacs will
break the line between them just fine, because reconnecting them with a
single space between would never be wrong.

As others have noted, using two spaces after periods will also work
well, and has other benefits.  Once you understand what's going on,
though, it's kind of cool.

Best regards,
Terry
-- 
T.F. Torrey

> From: Eli Zaretskii <eliz@gnu.org>
> To: help-gnu-emacs@gnu.org
> Date: Tue, 25 Sep 2012 23:50:37 +0200
> Subject: Re: line adjustment at the end of a sentence
> Message: 8
>
>> Date: Tue, 25 Sep 2012 17:25:47 -0400
>> From: Tom Kramer <kramer@cme.nist.gov>
>> 
>> 1. Start emacs from a command window by typing emacs -Q test
>> 
>> 2. Type the following, which will wrap around as you type.
>> 
>> 9/19/12 Worked 9.5 hours. Spent 1 hour misc. Spent 0.5 hour RTFI. 
>> Watched Mitutoyo vid of IMTS QIF demo. Exchanged email messages with Bob 
>> Brown.
>> 
>> 3. Type Esc-q The paragraph is set on three lines and looks like the 
>> following:
>> 
>> 9/19/12 Worked 9.5 hours. Spent 1 hour misc. Spent 0.5 hour
>> RTFI. Watched Mitutoyo vid of IMTS QIF demo. Exchanged email messages
>> with Bob Brown.
>> 
>> Note that the second line is much longer (69 characters) than the first 
>> (59 characters), and there is plenty of space for RTFI to fit on the 
>> first line.
>> 
>> That demonstrates the problem.
>
> Not reproducible here.  I get this instead:
>
> 9/19/12 Worked 9.5 hours. Spent 1 hour misc. Spent 0.5 hour RTFI.
> Watched Mitutoyo vid of IMTS QIF demo. Exchanged email messages
> with Bob Brown.
>
> which is quite reasonable.
>
> Something else is at work here, or there's something in your recipe
> that you didn't tell us.



reply via email to

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