aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/mail/flow-fill.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/mail/flow-fill.el')
-rw-r--r--lisp/mail/flow-fill.el36
1 files changed, 21 insertions, 15 deletions
diff --git a/lisp/mail/flow-fill.el b/lisp/mail/flow-fill.el
index af3b493a08a..f4b55031194 100644
--- a/lisp/mail/flow-fill.el
+++ b/lisp/mail/flow-fill.el
@@ -131,31 +131,37 @@ lines."
131 (goto-char (match-end 0)) 131 (goto-char (match-end 0))
132 (unless (looking-at " ") 132 (unless (looking-at " ")
133 (insert " ")) 133 (insert " "))
134 (end-of-line) 134 (while (and (eq (char-before (line-end-position)) ?\s)
135 (when (and (not (eobp)) 135 (not (eobp))
136 (save-excursion 136 (save-excursion
137 (forward-line 1) 137 (forward-line 1)
138 (looking-at (format "\\(%s ?\\)[^>]" prefix)))) 138 (looking-at (format "\\(%s ?\\)[^>]" prefix))))
139 ;; Delete the newline and the quote at the start of the 139 (end-of-line)
140 ;; next line. 140 (when (and (not (eobp))
141 (delete-region (point) (match-end 1)) 141 (save-excursion
142 (ignore-errors 142 (forward-line 1)
143 (looking-at (format "\\(%s ?\\)[^>]" prefix))))
144 ;; Delete the newline and the quote at the start of the
145 ;; next line.
146 (delete-region (point) (match-end 1))))
147 (ignore-errors
143 (let ((fill-prefix (concat prefix " ")) 148 (let ((fill-prefix (concat prefix " "))
144 adaptive-fill-mode) 149 adaptive-fill-mode)
145 (fill-region (line-beginning-position) 150 (fill-region (line-beginning-position)
146 (line-end-position) 151 (line-end-position)
147 'left 'nosqueeze)))))) 152 'left 'nosqueeze)))))
148 (t 153 (t
149 ;; Delete the newline. 154 ;; Delete the newline.
150 (when (eq (following-char) ?\s) 155 (when (eq (following-char) ?\s)
151 (delete-char 1)) 156 (delete-char 1))
152 ;; Hack: Don't do the flowing on the signature line. 157 ;; Hack: Don't do the flowing on the signature line.
153 (when (and (not (looking-at "-- $")) 158 (when (and (not (looking-at "-- $"))
154 (eq (char-before (line-end-position)) ?\s)) 159 (eq (char-before (line-end-position)) ?\s))
155 (end-of-line) 160 (while (eq (char-before (line-end-position)) ?\s)
156 (when delete-space 161 (end-of-line)
157 (delete-char -1)) 162 (when delete-space
158 (delete-char 1) 163 (delete-char -1))
164 (delete-char 1))
159 (ignore-errors 165 (ignore-errors
160 (let ((fill-prefix "")) 166 (let ((fill-prefix ""))
161 (fill-region (line-beginning-position) 167 (fill-region (line-beginning-position)