unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [RFC] [PATCH v1] emacs: More citation washing.
@ 2014-10-31 10:16 David Edmondson
  0 siblings, 0 replies; only message in thread
From: David Edmondson @ 2014-10-31 10:16 UTC (permalink / raw)
  To: notmuch

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)

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-10-31 10:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-31 10:16 [RFC] [PATCH v1] emacs: More citation washing David Edmondson

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

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 read-only IMAP folder(s) and NNTP newsgroup(s).