From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/55078 Path: main.gmane.org!not-for-mail From: Simon Josefsson Newsgroups: gmane.emacs.gnus.general Subject: Re: [flow-fill.el] Filling of quoted blank lines Date: Thu, 04 Dec 2003 00:21:06 +0100 Sender: ding-owner@lists.math.uh.edu Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-Trace: sea.gmane.org 1070493714 29292 80.91.224.253 (3 Dec 2003 23:21:54 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 3 Dec 2003 23:21:54 +0000 (UTC) Original-X-From: ding-owner+M3618@lists.math.uh.edu Thu Dec 04 00:21:50 2003 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1ARgJa-0002jJ-00 for ; Thu, 04 Dec 2003 00:21:50 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1ARgJN-0007DI-00; Wed, 03 Dec 2003 17:21:37 -0600 Original-Received: from justine.libertine.org ([66.139.78.221] ident=postfix) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1ARgJF-0007DC-00 for ding@lists.math.uh.edu; Wed, 03 Dec 2003 17:21:29 -0600 Original-Received: from yxa.extundo.com (178.230.13.217.in-addr.dgcsystems.net [217.13.230.178]) by justine.libertine.org (Postfix) with ESMTP id E98F43A003E for ; Wed, 3 Dec 2003 17:21:26 -0600 (CST) Original-Received: from latte (yxa.extundo.com [217.13.230.178]) (authenticated bits=0) by yxa.extundo.com (8.12.10/8.12.10) with ESMTP id hB3NLJrh010735 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NO) for ; Thu, 4 Dec 2003 00:21:20 +0100 Original-To: ding@gnus.org Mail-Copies-To: nobody X-Payment: hashcash 1.2 0:031203:ding@gnus.org:e6f60f085ce4e16e X-Hashcash: 0:031203:ding@gnus.org:e6f60f085ce4e16e In-Reply-To: (Ralf Angeli's message of "Wed, 03 Dec 2003 23:07:12 +0100") User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) Precedence: bulk Xref: main.gmane.org gmane.emacs.gnus.general:55078 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:55078 Ralf Angeli writes: > * Ralf Angeli (2003-12-03) writes: > >> I will see if I can find the bug. > > Okay, here is a new patch which works correctly AFAICS. I know it is > not very elegant as I just copied and adapted the code for finding the > signature but I did not want to change too much of the existing code. > > It would be nice if somebody could have a look at it and maybe check > it in if it is acceptable. I hope this is slightly more robust, please test it. It also fixes a long-standing problem in that: foo -- bar would be flowed together, when it shouldn't. There really need to be a regression test harness for flow-fill, it is difficult to tell what consequences even a minor change would have. --- flow-fill.el.~6.17.~ 2003-12-02 21:05:15.000000000 +0100 +++ flow-fill.el 2003-12-04 00:18:00.000000000 +0100 @@ -111,8 +111,7 @@ (when (save-excursion (beginning-of-line) (looking-at "^\\(>*\\)\\( ?\\)")) - (let ((quote (match-string 1)) - sig) + (let ((quote (match-string 1)) skiponeline) (if (string= quote "") (setq quote nil)) (when (and quote (string= (match-string 2) "")) @@ -121,11 +120,18 @@ (beginning-of-line) (when (> (skip-chars-forward ">") 0) (insert " ")))) - ;; XXX slightly buggy handling of "-- " + (unless (save-excursion + (beginning-of-line) + (looking-at (format "^%s ?-- $" (or quote " ?")))) (while (and (save-excursion - (ignore-errors (backward-char 3)) - (setq sig (looking-at "-- ")) - (looking-at "[^-][^-] ")) + (ignore-errors (forward-char 1)) + (not (setq skiponeline + ;; Next line contains signature separator. + (or (looking-at (format "^%s ?-- $" + (or quote ""))) + ;; Next line is empty, preserve it. + (looking-at (format "^%s * $" + (or quote ""))))))) (save-excursion (unless (eobp) (forward-char 1) @@ -136,7 +142,6 @@ "" "\\2"))) (backward-delete-char -1) (end-of-line)) - (unless sig (condition-case nil (let ((fill-prefix (when quote (concat quote " "))) (fill-column (eval fill-flowed-display-column)) @@ -147,7 +152,10 @@ 'left 'nosqueeze)) (error (forward-line 1) - nil)))))))) + nil)) + (when skiponeline + (forward-line 1) + (setq skiponeline nil)))))))) (provide 'flow-fill)