X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-wash.el;h=3a9ffdd0daf75af50deb80504ffeae9ee98410ff;hb=a4617f29ce81e7ae3e0cb747fdb9070f88407a28;hp=a76b4f5b589ab0d0f1ada7ced2bc024e31a5b91b;hpb=5ddaf59915b477d9eccfafaf7e5ac8094ea8f6ca;p=notmuch diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el index a76b4f5b..3a9ffdd0 100644 --- a/emacs/notmuch-wash.el +++ b/emacs/notmuch-wash.el @@ -1,4 +1,4 @@ -;; notmuch-wash.el --- cleaning up message bodies +;;; notmuch-wash.el --- cleaning up message bodies ;; ;; Copyright © Carl Worth ;; Copyright © David Edmondson @@ -16,14 +16,19 @@ ;; General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License -;; along with Notmuch. If not, see . +;; along with Notmuch. If not, see . ;; ;; Authors: Carl Worth ;; David Edmondson +;;; Code: + (require 'coolj) +(require 'notmuch-lib) -(declare-function notmuch-show-insert-bodypart "notmuch-show" (msg part depth &optional hide)) +(declare-function notmuch-show-insert-bodypart "notmuch-show" + (msg part depth &optional hide)) +(defvar notmuch-show-indent-messages-width) ;; @@ -119,8 +124,8 @@ collapse the remaining lines into a button." If this is nil, lines in messages will be wrapped to fit in the current window. If this is a number, lines will be wrapped after -this many characters or at the window width (whichever one is -lower)." +this many characters (ignoring indentation due to thread depth) +or at the window width (whichever one is lower)." :type '(choice (const :tag "window width" nil) (integer :tag "number of characters")) :group 'notmuch-wash) @@ -183,13 +188,16 @@ message parts." (let* ((type (overlay-get overlay 'type)) (invis-spec (overlay-get overlay 'invisible)) (state (if (invisible-p invis-spec) "hidden" "visible")) - (label-format (symbol-value (intern-soft (concat "notmuch-wash-button-" - type "-" state "-format")))) - (lines-count (count-lines (overlay-start overlay) (overlay-end overlay)))) + (label-format (symbol-value + (intern-soft + (format "notmuch-wash-button-%s-%s-format" + type state)))) + (lines-count (count-lines (overlay-start overlay) + (overlay-end overlay)))) (format label-format lines-count))) (defun notmuch-wash-region-to-button (msg beg end type &optional prefix) - "Auxiliary function to do the actual making of overlays and buttons + "Auxiliary function to do the actual making of overlays and buttons. BEG and END are buffer locations. TYPE should a string, either \"citation\" or \"signature\". Optional PREFIX is some arbitrary @@ -235,7 +243,8 @@ that PREFIX should not include a newline." (let* ((cite-start (match-beginning 0)) (cite-end (match-end 0)) (cite-lines (count-lines cite-start cite-end))) - (overlay-put (make-overlay cite-start cite-end) 'face 'notmuch-wash-cited-text) + (overlay-put (make-overlay cite-start cite-end) + 'face 'notmuch-wash-cited-text) (when (> cite-lines (+ notmuch-wash-citation-lines-prefix notmuch-wash-citation-lines-suffix 1)) @@ -257,7 +266,8 @@ that PREFIX should not include a newline." (sig-end-marker (make-marker))) (set-marker sig-start-marker sig-start) (set-marker sig-end-marker (point-max)) - (overlay-put (make-overlay sig-start-marker sig-end-marker) 'face 'message-cited-text) + (overlay-put (make-overlay sig-start-marker sig-end-marker) + 'face 'message-cited-text) (notmuch-wash-region-to-button msg sig-start-marker sig-end-marker "signature")))))) @@ -333,12 +343,13 @@ message at the window width. When doing so, citation leaders in the wrapped text are maintained." (let* ((coolj-wrap-follows-window-size nil) + (indent (* depth notmuch-show-indent-messages-width)) (limit (if (numberp notmuch-wash-wrap-lines-length) - (min notmuch-wash-wrap-lines-length + (min (+ notmuch-wash-wrap-lines-length indent) (window-width)) (window-width))) (fill-column (- limit - depth + indent ;; 2 to avoid poor interaction with ;; `word-wrap'. 2))) @@ -423,3 +434,5 @@ for error." ;; (provide 'notmuch-wash) + +;;; notmuch-wash.el ends here