[PATCH v2 3/3] emacs: Process format=flowed text

David Edmondson dme at dme.org
Sat Dec 22 04:10:58 PST 2018


If a text/plain part is declared as format=flowed, apply the
appropriate transformation for display using flow-fill.el.
---
 emacs/notmuch-show.el |  3 ++-
 emacs/notmuch-wash.el | 14 ++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index b3cefcd9..823a2d19 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -90,7 +90,8 @@ visible for any given message."
   :group 'notmuch-show
   :group 'notmuch-hooks)
 
-(defcustom notmuch-show-insert-text/plain-hook '(notmuch-wash-wrap-long-lines
+(defcustom notmuch-show-insert-text/plain-hook '(notmuch-wash-format=flowed
+						 notmuch-wash-wrap-long-lines
 						 notmuch-wash-tidy-citations
 						 notmuch-wash-elide-blank-lines
 						 notmuch-wash-excerpt-citations)
diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
index 54275ec7..d4f0e883 100644
--- a/emacs/notmuch-wash.el
+++ b/emacs/notmuch-wash.el
@@ -426,6 +426,20 @@ for error."
 
 ;;
 
+(require 'flow-fill)
+
+(defun notmuch-wash-format=flowed (msg part depth)
+  "If the current part content-type included 'format=flowed',
+apply the appropriate transformation."
+  (when (string= (plist-get part :format) "flowed")
+    ;; Adjust `fill-flowed-display-column' to allow for the indent
+    ;; that we will later apply to this content.
+    (let ((fill-flowed-display-column (- (eval fill-flowed-display-column)
+					 (* depth notmuch-show-indent-messages-width))))
+      (fill-flowed))))
+
+;;
+
 (provide 'notmuch-wash)
 
 ;;; notmuch-wash.el ends here
-- 
2.11.0



More information about the notmuch mailing list