From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: filling bug in text-mode Date: Fri, 14 Oct 2005 14:42:12 +0300 Organization: JURTA Message-ID: <87u0fk5nqj.fsf@jurta.org> References: <87psqdhq7n.fsf@jurta.org> <20051011.063411.71091056.wl@gnu.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1129290755 17040 80.91.229.2 (14 Oct 2005 11:52:35 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 14 Oct 2005 11:52:35 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 14 13:52:31 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EQO6H-0005oK-NN for ged-emacs-devel@m.gmane.org; Fri, 14 Oct 2005 13:51:50 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EQO6H-0003rU-09 for ged-emacs-devel@m.gmane.org; Fri, 14 Oct 2005 07:51:49 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EQO4Y-0003jD-D8 for emacs-devel@gnu.org; Fri, 14 Oct 2005 07:50:02 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EQO4X-0003ix-Jt for emacs-devel@gnu.org; Fri, 14 Oct 2005 07:50:02 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EQO4W-0003it-K1 for emacs-devel@gnu.org; Fri, 14 Oct 2005 07:50:00 -0400 Original-Received: from [194.126.101.111] (helo=mail.neti.ee) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EQO4U-0005Tl-00; Fri, 14 Oct 2005 07:49:58 -0400 Original-Received: from mail.neti.ee (80-235-32-47-dsl.mus.estpak.ee [80.235.32.47]) by Relayhost1.neti.ee (Postfix) with ESMTP id 8A8DB1FC1; Fri, 14 Oct 2005 14:50:09 +0300 (EEST) Original-To: rms@gnu.org In-Reply-To: (Richard M. Stallman's message of "Tue, 11 Oct 2005 18:42:31 -0400") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) X-Virus-Scanned: by amavisd-new-2.2.1 (20041222) (Debian) at neti.ee X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:44028 Archived-At: > 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/