unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
Cc: emacs-devel@gnu.org
Subject: Re: filling bug in text-mode
Date: Fri, 14 Oct 2005 14:42:12 +0300	[thread overview]
Message-ID: <87u0fk5nqj.fsf@jurta.org> (raw)
In-Reply-To: <E1EPSpL-0007Lt-QF@fencepost.gnu.org> (Richard M. Stallman's message of "Tue, 11 Oct 2005 18:42:31 -0400")

> We're talking about what sentence-end should match; that is to say,
> where M-e should stop.
>
> It should stop after an ellipsis if the ellipsis is followed by two
> spaces or a newline.  An ellipsis followed by just one space is not
> the end of a sentence.
>
> As for filling, it does not break the line after a period
> followed by one space, because doing so would make it appear
> to be the end of a sentence.

While looking at fixing this, I noticed that there are more cases
where `fill-nobreak-p' doesn't allow breaking at the end of a sentence
(where M-e stops).

For example, filling:

It's not necessary to buy a new computer just for a DVD
drive. . .  Today, the most important part of a computer is the amount
of RAM -- the more, the better.  It's far more important than a fast
CPU.

doesn't break at two spaces between `. . .' and `Today'.  Whereas the
expected result of filling would be:

It's not necessary to buy a new computer just for a DVD drive. . .
Today, the most important part of a computer is the amount of RAM --
the more, the better.  It's far more important than a fast CPU.

There is another example:

It's not necessary to buy a new computer just for a DVD
drive.  . . Today, the most important part of a computer is the amount
of RAM -- the more, the better.  It's far more important than a fast
CPU.

where filling breaks at wrong point, turning this paragraph into:

It's not necessary to buy a new computer just for a DVD drive.  . .
Today, the most important part of a computer is the amount of RAM --
the more, the better.  It's far more important than a fast CPU.

while the expected result should have breaking at two spaces:

It's not necessary to buy a new computer just for a DVD drive.
. . Today, the most important part of a computer is the amount of
RAM -- the more, the better.  It's far more important than a fast CPU.

The patch below fixes these cases as well as the original problem:

Index: lisp/textmodes/fill.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/textmodes/fill.el,v
retrieving revision 1.181
diff -c -r1.181 fill.el
*** lisp/textmodes/fill.el	9 Aug 2005 14:01:29 -0000	1.181
--- lisp/textmodes/fill.el	14 Oct 2005 11:38:09 -0000
***************
*** 344,356 ****
       ;; it at the end of the line.
       (and sentence-end-double-space
  	  (save-excursion
! 	    (skip-chars-backward ". ")
! 	    (looking-at "\\. \\([^ ]\\|$\\)")))
       ;; Another approach to the same problem.
       (save-excursion
!        (skip-chars-backward ". ")
!        (and (looking-at "\\.")
!      	    (not (looking-at (sentence-end)))))
       ;; Don't split a line if the rest would look like a new paragraph.
       (unless use-hard-newlines
         (save-excursion
--- 344,357 ----
       ;; it at the end of the line.
       (and sentence-end-double-space
  	  (save-excursion
! 	    (skip-chars-backward " ")
! 	    (and (eq (preceding-char) ?.)
! 		 (looking-at " \\([^ ]\\|$\\)"))))
       ;; Another approach to the same problem.
       (save-excursion
!        (skip-chars-backward " ")
!        (and (eq (preceding-char) ?.)
! 	    (not (progn (forward-char -1) (looking-at (sentence-end))))))
       ;; Don't split a line if the rest would look like a new paragraph.
       (unless use-hard-newlines
         (save-excursion

-- 
Juri Linkov
http://www.jurta.org/emacs/

  reply	other threads:[~2005-10-14 11:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-05 20:40 filling bug in text-mode Werner LEMBERG
2005-10-07 21:52 ` Juri Linkov
2005-10-08 22:57   ` Richard M. Stallman
2005-10-09  6:06     ` Juri Linkov
2005-10-10  4:14       ` Richard M. Stallman
2005-10-10  6:14         ` Juri Linkov
2005-10-10 13:44           ` Werner LEMBERG
2005-10-10 23:48           ` Richard M. Stallman
2005-10-11  4:34             ` Werner LEMBERG
2005-10-11 22:42               ` Richard M. Stallman
2005-10-14 11:42                 ` Juri Linkov [this message]
2005-10-11  7:22             ` David Kastrup
2005-10-11 14:31               ` Stefan Monnier
2005-10-11 22:43                 ` Richard M. Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87u0fk5nqj.fsf@jurta.org \
    --to=juri@jurta.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).