unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* auto-fill breaks line too early
@ 2012-10-18  8:12 mandar.mitra
  2012-10-18  8:33 ` Michael Heerdegen
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: mandar.mitra @ 2012-10-18  8:12 UTC (permalink / raw)
  To: help-gnu-emacs

I type the following (single) line in Emacs 24 [1] (started as emacs -Q):

--------------------
A study of the number of relevant documents for queries may provide some insights about the collections when juxtaposed across the FIRE years. Voorhees and 
--------------------

I turn on auto-fill-mode, place cursor on i (for insight) and hit C-x f to
set fill column to 73. Then I go to the end of the line and hit space. This
produces:

--------------------
A study of the number of relevant documents for queries may provide some
insights about the collections when juxtaposed across the FIRE
years. Voorhees and  
--------------------

Why does auto-fill break the line before years instead of after? This
happens across emacs versions, whenever there is a sentence break close to
the fill-column. If I delete the period, the line break is inserted after
years as expected.

Is this a bug or a feature? Is there a workaround or should I file a bug /
look in the code?

Many thanks,
Mandar.



[1] GNU Emacs 24.1.50.1 (i686-pc-linux-gnu, GTK+ Version 3.2.0) of 2012-09-19 on litembilla, modified by Debian


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: auto-fill breaks line too early
  2012-10-18  8:12 auto-fill breaks line too early mandar.mitra
@ 2012-10-18  8:33 ` Michael Heerdegen
  2012-10-18  8:34 ` Teemu Likonen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Michael Heerdegen @ 2012-10-18  8:33 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,


the doc of `fill-paragraph' reveals the mystery:

| If `sentence-end-double-space' is non-nil, then period followed by one
| space does not end a sentence, so don't break a line there.

The default value is t. So, no, it's not a bug.  Customize
`sentence-end-double-space' to nil to change the behavior.


Michael.


> I type the following (single) line in Emacs 24 [1] (started as emacs -Q):
>
> --------------------
> A study of the number of relevant documents for queries may provide
> some insights about the collections when juxtaposed across the FIRE
> years. Voorhees and
> --------------------
>
> I turn on auto-fill-mode, place cursor on i (for insight) and hit C-x f to
> set fill column to 73. Then I go to the end of the line and hit space. This
> produces:
>
> --------------------
> A study of the number of relevant documents for queries may provide some
> insights about the collections when juxtaposed across the FIRE
> years. Voorhees and  
> --------------------
>
> Why does auto-fill break the line before years instead of after? This
> happens across emacs versions, whenever there is a sentence break close to
> the fill-column. If I delete the period, the line break is inserted after
> years as expected.
>
> Is this a bug or a feature? Is there a workaround or should I file a bug /
> look in the code?
>
> Many thanks,
> Mandar.
>
>
>
> [1] GNU Emacs 24.1.50.1 (i686-pc-linux-gnu, GTK+ Version 3.2.0) of
> 2012-09-19 on litembilla, modified by Debian



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: auto-fill breaks line too early
  2012-10-18  8:12 auto-fill breaks line too early mandar.mitra
  2012-10-18  8:33 ` Michael Heerdegen
@ 2012-10-18  8:34 ` Teemu Likonen
  2012-10-18 12:30   ` Mandar Mitra
  2012-10-18  8:40 ` Tassilo Horn
       [not found] ` <mailman.11206.1350549236.855.help-gnu-emacs@gnu.org>
  3 siblings, 1 reply; 9+ messages in thread
From: Teemu Likonen @ 2012-10-18  8:34 UTC (permalink / raw)
  To: mandar mitra; +Cc: help-gnu-emacs

mandar mitra [2012-10-18 01:12:50 -0700] wrote:

> Is this a bug or a feature?

A feature. See variable "sentence-end-double-space" and the Emacs Editor
manual section "(emacs) Sentences".



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: auto-fill breaks line too early
  2012-10-18  8:12 auto-fill breaks line too early mandar.mitra
  2012-10-18  8:33 ` Michael Heerdegen
  2012-10-18  8:34 ` Teemu Likonen
@ 2012-10-18  8:40 ` Tassilo Horn
       [not found] ` <mailman.11206.1350549236.855.help-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 9+ messages in thread
From: Tassilo Horn @ 2012-10-18  8:40 UTC (permalink / raw)
  To: help-gnu-emacs

"mandar.mitra" <mandar.mitra@gmail.com> writes:

Hi Mandar,

> I turn on auto-fill-mode, place cursor on i (for insight) and hit C-x f to
> set fill column to 73. Then I go to the end of the line and hit space. This
> produces:
>
> --------------------
> A study of the number of relevant documents for queries may provide some
> insights about the collections when juxtaposed across the FIRE
> years. Voorhees and  
> --------------------
>
> Why does auto-fill break the line before years instead of after?

That's because emacs thinks "years." is an abbreviation.  If you'd use
two spaces after a dot ending a sentence, it'll work as you expected.

You can change this by setting this to nil.

,----[ C-h v sentence-end-double-space RET ]
| sentence-end-double-space is a variable defined in `paragraphs.el'.
| Its value is t
| 
|   This variable is safe as a file local variable if its value
|   satisfies the predicate `booleanp'.
| 
| Documentation:
| Non-nil means a single space does not end a sentence.
| This is relevant for filling.  See also `sentence-end-without-period'
| and `colon-double-space'.
| 
| This value is used by the function `sentence-end' to construct the
| regexp describing the end of a sentence, when the value of the variable
| `sentence-end' is nil.  See Info node `(elisp)Standard Regexps'.
| 
| You can customize this variable.
`----

However, keep in mind that then the sentence moving commands like `M-a'
and `M-e' also stop at real abbreviations like in "bla, bla, etc. bla
bla."

If you check some messages here on the list, you'll see that most
long-time emacs users have two spaces after the dot ending a sentence.
Ditto in this message.  Now you know why.

Bye,
Tassilo




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: auto-fill breaks line too early
       [not found] ` <mailman.11206.1350549236.855.help-gnu-emacs@gnu.org>
@ 2012-10-18 12:25   ` Barry Margolin
  2012-11-25  1:27   ` David Combs
  1 sibling, 0 replies; 9+ messages in thread
From: Barry Margolin @ 2012-10-18 12:25 UTC (permalink / raw)
  To: help-gnu-emacs

In article <mailman.11206.1350549236.855.help-gnu-emacs@gnu.org>,
 Michael Heerdegen <michael_heerdegen@web.de> wrote:

> Hi,
> 
> 
> the doc of `fill-paragraph' reveals the mystery:
> 
> | If `sentence-end-double-space' is non-nil, then period followed by one
> | space does not end a sentence, so don't break a line there.
> 
> The default value is t. So, no, it's not a bug.  Customize
> `sentence-end-double-space' to nil to change the behavior.

And if you want to understand the rationale for this, see a very similar 
thread from 3-4 weeks ago.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: auto-fill breaks line too early
  2012-10-18  8:34 ` Teemu Likonen
@ 2012-10-18 12:30   ` Mandar Mitra
  0 siblings, 0 replies; 9+ messages in thread
From: Mandar Mitra @ 2012-10-18 12:30 UTC (permalink / raw)
  To: help-gnu-emacs

Teemu Likonen wrote (Thu, Oct 18, 2012 at 11:34:18AM +0300):
> mandar mitra [2012-10-18 01:12:50 -0700] wrote:
> 
> > Is this a bug or a feature?
> 
> A feature. See variable "sentence-end-double-space" and the Emacs Editor
> manual section "(emacs) Sentences".

Wow! Many thanks! Truly, a lifetime of learning..

mandar.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: auto-fill breaks line too early
       [not found] ` <mailman.11206.1350549236.855.help-gnu-emacs@gnu.org>
  2012-10-18 12:25   ` Barry Margolin
@ 2012-11-25  1:27   ` David Combs
  2012-11-25  3:05     ` Drew Adams
       [not found]     ` <mailman.13738.1353812732.855.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 9+ messages in thread
From: David Combs @ 2012-11-25  1:27 UTC (permalink / raw)
  To: help-gnu-emacs

In article <mailman.11206.1350549236.855.help-gnu-emacs@gnu.org>,
Michael Heerdegen  <michael_heerdegen@web.de> wrote:
>Hi,
>
>
>the doc of `fill-paragraph' reveals the mystery:
>
>| If `sentence-end-double-space' is non-nil, then period followed by one
>| space does not end a sentence, so don't break a line there.
>
>The default value is t. So, no, it's not a bug.  Customize
>`sentence-end-double-space' to nil to change the behavior.
>
>
>Michael.


So I guess the oft-used M-x delete-trailing-whitespace screws up
any use of M-q?

Emacs is so dwim-intelligent about so many things that it's a
surprise to me that a period (or ! or ?, etc) meant to end a 
sentence line requires two spaces, which is fine in the middle
of a line, would still obtain at the end of a line.

Perhaps in that double-space mode the emacs user could avoid
ending a line with a period UNLESS that period was to mean
"end of sentence".

Like, he'd have to teach himself to never end a line with 
a mid-sentence abbreviation.  And he'd never get into that
mode except by deliberately invoking it, plus when he did
enter that mode a message would flash up warning him about
how NOT to end a line.

---

Question: do other emacs users find delete-trailing-whitespace
useful?

Crazy idea?  Maybe in that two-spaces mode, delete-trailing-whitespace
would know to NOT remove two spaces following a sentence-ender?


A problem, all this.

David

PS: And oh, yes, I very much like the two-spaces-between-sentences way
of entering and storing text.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: auto-fill breaks line too early
  2012-11-25  1:27   ` David Combs
@ 2012-11-25  3:05     ` Drew Adams
       [not found]     ` <mailman.13738.1353812732.855.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 9+ messages in thread
From: Drew Adams @ 2012-11-25  3:05 UTC (permalink / raw)
  To: 'David Combs', help-gnu-emacs

> So I guess the oft-used M-x delete-trailing-whitespace screws up
> any use of M-q?

Why do you say that?  Did you try it?

> ... it's a surprise to me that a period (or ! or ?, etc)
> meant to end a sentence line requires two spaces, which is
> fine in the middle of a line, would still obtain at the end
> of a line.
> 
> Perhaps in that double-space mode the emacs user could avoid
> ending a line with a period UNLESS that period was to mean
> "end of sentence".
> 
> Like, he'd have to teach himself to never end a line with 
> a mid-sentence abbreviation.  And he'd never get into that
> mode except by deliberately invoking it, plus when he did
> enter that mode a message would flash up warning him about
> how NOT to end a line.

It makes no difference whether a line ends in `.'.  M-q still respects the
two-space rule if `sentence-end-double-space' is non-nil.

Seems like you went to a lot of trouble (mis)interpreting the doc, without
actually trying it.  (Unless of course I misunderstand what you are saying.)

> 
> ---
> 
> Question: do other emacs users find delete-trailing-whitespace
> useful?
> 
> Crazy idea?  Maybe in that two-spaces mode, delete-trailing-whitespace
> would know to NOT remove two spaces following a sentence-ender?
> 
> 
> A problem, all this.
> 
> David
> 
> PS: And oh, yes, I very much like the two-spaces-between-sentences way
> of entering and storing text.
> 




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: auto-fill breaks line too early
       [not found]     ` <mailman.13738.1353812732.855.help-gnu-emacs@gnu.org>
@ 2012-12-08  0:50       ` David Combs
  0 siblings, 0 replies; 9+ messages in thread
From: David Combs @ 2012-12-08  0:50 UTC (permalink / raw)
  To: help-gnu-emacs

In article <mailman.13738.1353812732.855.help-gnu-emacs@gnu.org>,
Drew Adams <drew.adams@oracle.com> wrote:
>> So I guess the oft-used M-x delete-trailing-whitespace screws up
>> any use of M-q?
>
>Why do you say that?  Did you try it?
>
>> ... it's a surprise to me that a period (or ! or ?, etc)
>> meant to end a sentence line requires two spaces, which is
>> fine in the middle of a line, would still obtain at the end
>> of a line.
>> 
>> Perhaps in that double-space mode the emacs user could avoid
>> ending a line with a period UNLESS that period was to mean
>> "end of sentence".
>> 
>> Like, he'd have to teach himself to never end a line with 
>> a mid-sentence abbreviation.  And he'd never get into that
>> mode except by deliberately invoking it, plus when he did
>> enter that mode a message would flash up warning him about
>> how NOT to end a line.
>
>It makes no difference whether a line ends in `.'.  M-q still respects the
>two-space rule if `sentence-end-double-space' is non-nil.
>
>Seems like you went to a lot of trouble (mis)interpreting the doc, without
>actually trying it.  (Unless of course I misunderstand what you are saying.)
>
>> 
>> ---
>> 
>> Question: do other emacs users find delete-trailing-whitespace
>> useful?
>> 
>> Crazy idea?  Maybe in that two-spaces mode, delete-trailing-whitespace
>> would know to NOT remove two spaces following a sentence-ender?
>> 
>> 
>> A problem, all this.
>> 
>> David
>> 
>> PS: And oh, yes, I very much like the two-spaces-between-sentences way
>> of entering and storing text.
>> 
>
>

Thanks for the info on that variable!

David



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-12-08  0:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-18  8:12 auto-fill breaks line too early mandar.mitra
2012-10-18  8:33 ` Michael Heerdegen
2012-10-18  8:34 ` Teemu Likonen
2012-10-18 12:30   ` Mandar Mitra
2012-10-18  8:40 ` Tassilo Horn
     [not found] ` <mailman.11206.1350549236.855.help-gnu-emacs@gnu.org>
2012-10-18 12:25   ` Barry Margolin
2012-11-25  1:27   ` David Combs
2012-11-25  3:05     ` Drew Adams
     [not found]     ` <mailman.13738.1353812732.855.help-gnu-emacs@gnu.org>
2012-12-08  0:50       ` David Combs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).