[PATCH] emacs: Add configurable wrapping width for notmuch-wash-wrap-long-lines

Mark Walters markwalters1009 at gmail.com
Sun Apr 15 10:39:12 PDT 2012


On Fri, 17 Feb 2012, Daniel Schoepe <daniel at schoepe.org> wrote:
> This introduces a variable to control after how many characters a line
> is wrapped by notmuch-wash-wrap-long-lines (still wrapping at the
> window width if it is lower).

Hi 

This looks ok but I wonder if slightly different behaviour might be
preferable (and looks simple to implement): rather then always wrapping
at min of notmuch-wash-wrap-lines-length and window-width wrap at min of
(notmuch-wash-wrap-lines-length + depth) and window-width. Then if you
have a wide buffer you can still get 80 chars (say) of useful text even
for well nested messages whilst not having very long lines anywhere.

Best wishes

Mark

> ---
>  emacs/notmuch-wash.el |   36 ++++++++++++++++++++++++++----------
>  1 files changed, 26 insertions(+), 10 deletions(-)
>
> diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
> index 56981d0..7d003a2 100644
> --- a/emacs/notmuch-wash.el
> +++ b/emacs/notmuch-wash.el
> @@ -87,6 +87,14 @@ If there is one more line than the sum of
>  `notmuch-wash-citation-lines-suffix', show that, otherwise
>  collapse the remaining lines into a button.")
>  
> +(defvar notmuch-wash-wrap-lines-length nil
> +  "Wrap line after at most this many characters.
> +
> +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).")
> +
>  (defun notmuch-wash-toggle-invisible-action (cite-button)
>    (let ((invis-spec (button-get cite-button 'invisibility-spec)))
>      (if (invisible-p invis-spec)
> @@ -276,16 +284,24 @@ Perform several transformations on the message body:
>  ;;
>  
>  (defun notmuch-wash-wrap-long-lines (msg depth)
> -  "Wrap any long lines in the message to the width of the window.
> -
> -When doing so, maintaining citation leaders in the wrapped text."
> -
> -  (let ((coolj-wrap-follows-window-size nil)
> -	(fill-column (- (window-width)
> -			depth
> -			;; 2 to avoid poor interaction with
> -			;; `word-wrap'.
> -			2)))
> +  "Wrap long lines in the message.
> +
> +If `notmuch-wash-wrap-lines-length' is a number, this will wrap
> +the message lines to the minimum of the width of the window or
> +its value. Otherwise, this function will wrap long lines in the
> +message at the window width. When doing so, citation leaders in
> +the wrapped text are maintained."
> +
> +  (let* ((coolj-wrap-follows-window-size nil)
> +	 (limit (if (numberp notmuch-wash-wrap-lines-length)
> +		    (min notmuch-wash-wrap-lines-length
> +			 (window-width))
> +		  (window-width)))
> +	 (fill-column (- limit
> +			 depth
> +			 ;; 2 to avoid poor interaction with
> +			 ;; `word-wrap'.
> +			 2)))
>      (coolj-wrap-region (point-min) (point-max))))
>  
>  ;;
> -- 
> 1.7.9
>
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list