[gnus git] branch master updated: =1= (fill-flowed-encode): Do encoding citation-aware.

Lars Magne Ingebrigtsen <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  414acad091c275084c30e8354e96b8ba26169eff (commit)
      from  70fb02450c4c5ccd9b2d80567223510d29186ead (commit)


- Log -----------------------------------------------------------------
commit 414acad091c275084c30e8354e96b8ba26169eff
Author: Lars Magne Ingebrigtsen <[email protected]>
Date:   Tue Jan 4 00:48:43 2011 +0100

    (fill-flowed-encode): Do encoding citation-aware.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c174dac..586e706 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
+2011-01-03  Lars Magne Ingebrigtsen  <[email protected]>
+
+	* flow-fill.el (fill-flowed-encode): Do encoding citation-aware.
+
 2011-01-03  Glenn Morris  <[email protected]>
 
 	* sieve-manage.el (sieve-manage-open): Correctly set sieve-manage-port.
diff --git a/lisp/flow-fill.el b/lisp/flow-fill.el
index 2420577..66422d2 100644
--- a/lisp/flow-fill.el
+++ b/lisp/flow-fill.el
@@ -1,7 +1,7 @@
 ;;; flow-fill.el --- interpret RFC2646 "flowed" text
 
-;; Copyright (C) 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+;;   2009, 2010, 2011 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <[email protected]>
 ;; Keywords: mail
@@ -82,19 +82,38 @@ RFC 2646 suggests 66 characters for readability."
 	;; Go through each paragraph, filling it and adding SPC
 	;; as the last character on each line.
 	(while (setq end (text-property-any start (point-max) 'hard 't))
+	  (save-restriction
+	    (narrow-to-region start end)
 	  (let ((fill-column (eval fill-flowed-encode-column)))
-	    (fill-region start end t 'nosqueeze 'to-eop))
-	  (goto-char start)
-	  ;; `fill-region' probably distorted end.
-	  (setq end (text-property-any start (point-max) 'hard 't))
-	  (while (and (< (point) end)
-		      (re-search-forward "$" (1- end) t))
-	    (insert " ")
-	    (setq end (1+ end))
-	    (forward-char))
-	  (goto-char (setq start (1+ end)))))
+	      (fill-flowed-fill-buffer))
+	    (goto-char (point-min))
+	    (while (re-search-forward "\n" nil t)
+	      (replace-match " \n" t t))
+	    (goto-char (setq start (1+ (point-max)))))))
       t)))
 
+(defun fill-flowed-fill-buffer ()
+  (let ((prefix nil)
+	(prev-prefix nil)
+	(start (point-min)))
+    (goto-char (point-min))
+    (while (not (eobp))
+      (setq prefix (and (looking-at "[> ]+")
+			(match-string 0)))
+      (if (equal prefix prev-prefix)
+	  (forward-line 1)
+	(save-restriction
+	  (narrow-to-region start (point))
+	  (let ((fill-prefix prev-prefix))
+	    (fill-region (point-min) (point-max) t 'nosqueeze 'to-eop))
+	  (goto-char (point-max)))
+	(setq prev-prefix prefix
+	      start (point))))
+    (save-restriction
+      (narrow-to-region start (point))
+      (let ((fill-prefix prev-prefix))
+	(fill-region (point-min) (point-max) t 'nosqueeze 'to-eop)))))
+
 ;;;###autoload
 (defun fill-flowed (&optional buffer delete-space)
   (with-current-buffer (or (current-buffer) buffer)

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog    |    4 ++++
 lisp/flow-fill.el |   45 ++++++++++++++++++++++++++++++++-------------
 2 files changed, 36 insertions(+), 13 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.