Gnus development mailing list
 help / color / mirror / Atom feed
From: Simon Josefsson <jas@extundo.com>
Subject: Re: [flow-fill.el] Filling of quoted blank lines
Date: Thu, 04 Dec 2003 00:21:06 +0100	[thread overview]
Message-ID: <ilu4qwha3od.fsf@latte.josefsson.org> (raw)
In-Reply-To: <bqlmqt$lhk$1@quimby.gnus.org> (Ralf Angeli's message of "Wed, 03 Dec 2003 23:07:12 +0100")

Ralf Angeli <dev.null@iwi.uni-sb.de> 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)
 




  reply	other threads:[~2003-12-03 23:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-02 17:35 Ralf Angeli
2003-12-02 18:00 ` Simon Josefsson
2003-12-02 18:16   ` Ralf Angeli
2003-12-03  8:23   ` Ralf Angeli
2003-12-03 22:07     ` Ralf Angeli
2003-12-03 23:21       ` Simon Josefsson [this message]
2003-12-04 10:09         ` Ralf Angeli
2003-12-04 15:36           ` Simon Josefsson
2004-01-19 10:05 ` Ralf Angeli
2004-01-27 14:43   ` Ralf Angeli
2004-01-27 20:46     ` Simon Josefsson
2004-01-28  8:04       ` Ralf Angeli
2004-01-28 16:47         ` Simon Josefsson

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

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

  git send-email \
    --in-reply-to=ilu4qwha3od.fsf@latte.josefsson.org \
    --to=jas@extundo.com \
    /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.
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 NNTP newsgroup(s).