;;; flow-fill.el --- interpret RFC2646 "flowed" text
;; Copyright (C) 2000, 2001, 2002, 2003, 2004,
-;; 2005 Free Software Foundation, Inc.
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: Simon Josefsson <jas@pdc.kth.se>
;; Keywords: mail
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
t)))
;;;###autoload
-(defun fill-flowed (&optional buffer)
+(defun fill-flowed (&optional buffer delete-space)
(save-excursion
(set-buffer (or (current-buffer) buffer))
(goto-char (point-min))
;; Remove space stuffing.
- (while (re-search-forward "^ " nil t)
+ (while (re-search-forward "^\\( \\|>+ $\\)" nil t)
(delete-char -1)
(forward-line 1))
(goto-char (point-min))
(while (re-search-forward " $" nil t)
+ (when delete-space
+ (delete-char -1))
(when (save-excursion
(beginning-of-line)
(looking-at "^\\(>*\\)\\( ?\\)"))