[RFC] [PATCH v1] emacs: More citation washing.
David Edmondson
dme at dme.org
Fri Oct 31 03:16:07 PDT 2014
Ensure that a citation is preceded and followed by a blank line,
unless the preceding line looks like a citation leader.
---
Washing changes are always a bit risky, as they are heuristic
based. Testers for this (alleged) improvement welcome!
emacs/notmuch-wash.el | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
index 8fe91e1..83621bb 100644
--- a/emacs/notmuch-wash.el
+++ b/emacs/notmuch-wash.el
@@ -276,7 +276,19 @@ Perform several transformations on the message body:
;; text.
(goto-char (point-min))
(while (re-search-forward "\\(^>[> ]*\n\\)\\(^$\\|^[^>].*\\)" nil t)
- (replace-match "\\2")))
+ (replace-match "\\2"))
+
+ ;; Ensure that a citation block has a blank line before it, unless
+ ;; the previous line ends in ':' (because that's probably the
+ ;; citation).
+ (goto-char (point-min))
+ (while (re-search-forward "^[^>].*[^:]\\(\n\\)>.*" nil t)
+ (replace-match "\n\n" nil nil nil 1))
+
+ ;; Ensure that a citation block has a blank line after it.
+ (goto-char (point-min))
+ (while (re-search-forward "^>.*\\(\n\\)[^>].*" nil t)
+ (replace-match "\n\n" nil nil nil 1)))
;;
--
1.9.3 (Apple Git-50)
More information about the notmuch
mailing list