aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs/notmuch-show.el
diff options
context:
space:
mode:
authorGravatar David Edmondson <dme@dme.org>2010-04-22 13:26:06 +0100
committerGravatar Carl Worth <cworth@cworth.org>2010-04-24 07:52:37 -0700
commit97570954cb583cacac35b0235cbe449a07630ae3 (patch)
treef143e9386bf7d596c922b3009ef55873dcc5d9c9 /emacs/notmuch-show.el
parent7c5f017a30bda339eacb4cdde08a9a7aee3662f4 (diff)
emacs: Add more functions to clean up text/plain parts
Add: - notmuch-wash-wrap-long-lines: Wrap lines longer than the width of the current window whilst maintaining any citation prefix. - notmuch-wash-tidy-citations: Tidy up citations by: - compress repeated otherwise blank citation lines, - remove otherwise blank citation lines at the head and tail of a citation and remove blank lines between attribution statements and the citation, - notmuch-wash-compress-blanks: Compress repeated blank lines and remove leading and trailing blank lines. Enable `notmuch-wash-tidy-citations' and `notmuch-wash-compress-blanks' by default by adding them to `notmuch-show-insert-text/plain-hook'. `notmuch-wash-wrap-long-lines' is not enabled by default. If `notmuch-wash-wrap-long-lines' is enabled, word wrapping of the buffer leads to an unappealing display of text, so provide a function to disable it and add it to the list of `notmuch-show-mode' hook functions.
Diffstat (limited to 'emacs/notmuch-show.el')
-rw-r--r--emacs/notmuch-show.el27
1 files changed, 22 insertions, 5 deletions
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index f958a306..aa8041c2 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -62,17 +62,34 @@ any given message."
"A list of functions called to decorate the headers listed in
`notmuch-message-headers'.")
-(defvar notmuch-show-hook '(notmuch-show-pretty-hook)
+(defcustom notmuch-show-hook '(notmuch-show-pretty-hook)
"A list of functions called after populating a
-`notmuch-show' buffer.")
-
-(defvar notmuch-show-insert-text/plain-hook '(notmuch-wash-text/plain-citations)
- "A list of functions called to clean up text/plain body parts.")
+`notmuch-show' buffer."
+ :group 'notmuch
+ :type 'hook
+ :options '(notmuch-show-pretty-hook
+ notmuch-show-turn-off-word-wrap))
+
+(defcustom notmuch-show-insert-text/plain-hook
+ '(notmuch-wash-tidy-citations
+ notmuch-wash-compress-blanks
+ notmuch-wash-markup-citations)
+ "A list of functions called to clean up text/plain body parts."
+ :group 'notmuch
+ :type 'hook
+ :options '(notmuch-wash-wrap-long-lines
+ notmuch-wash-tidy-citations
+ notmuch-wash-compress-blanks
+ notmuch-wash-markup-citations))
(defun notmuch-show-pretty-hook ()
(goto-address-mode 1)
(visual-line-mode))
+(defun notmuch-show-turn-off-word-wrap ()
+ ;; `toggle-word-wrap' outputs a message, which is distracting.
+ (setq word-wrap nil))
+
(defmacro with-current-notmuch-show-message (&rest body)
"Evaluate body with current buffer set to the text of current message"
`(save-excursion