From 34cafc448246309baac63816c2a6963b839d1451 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Sun, 15 Apr 2012 18:39:12 +0100 Subject: [PATCH] Re: [PATCH] emacs: Add configurable wrapping width for notmuch-wash-wrap-long-lines --- 2f/b54d2e3826ff743a66aafe11983f027f30c3b9 | 160 ++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 2f/b54d2e3826ff743a66aafe11983f027f30c3b9 diff --git a/2f/b54d2e3826ff743a66aafe11983f027f30c3b9 b/2f/b54d2e3826ff743a66aafe11983f027f30c3b9 new file mode 100644 index 000000000..aa5a21335 --- /dev/null +++ b/2f/b54d2e3826ff743a66aafe11983f027f30c3b9 @@ -0,0 +1,160 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id B34AC431FAF + for ; Sun, 15 Apr 2012 10:38:56 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -1.098 +X-Spam-Level: +X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id R6lfBofc0Khi for ; + Sun, 15 Apr 2012 10:38:55 -0700 (PDT) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 7812A431FAE + for ; Sun, 15 Apr 2012 10:38:55 -0700 (PDT) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1SJTPZ-0001OA-Bk; Sun, 15 Apr 2012 18:38:54 +0100 +Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223] + helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) + (envelope-from ) + id 1SJTPZ-0003EU-06; Sun, 15 Apr 2012 18:38:53 +0100 +From: Mark Walters +To: Daniel Schoepe , notmuch@notmuchmail.org +Subject: Re: [PATCH] emacs: Add configurable wrapping width for + notmuch-wash-wrap-long-lines +In-Reply-To: <1329503684-31289-1-git-send-email-daniel@schoepe.org> +References: <1329503684-31289-1-git-send-email-daniel@schoepe.org> +User-Agent: Notmuch/0.12+110~gbc97b4a (http://notmuchmail.org) Emacs/23.3.1 + (x86_64-pc-linux-gnu) +Date: Sun, 15 Apr 2012 18:39:12 +0100 +Message-ID: <87fwc46gjj.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 94.192.233.223 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: 1c166aab3b4dd4b43bfaa2dbbffba692 (of first 20000 bytes) +X-SpamAssassin-Score: -1.8 +X-SpamAssassin-SpamBar: - +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored -1.8 points. + Summary of the scoring: + * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, + * medium trust + * [138.37.6.40 listed in list.dnswl.org] + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay + * domain + * 0.5 AWL AWL: From: address is in the auto white-list +X-QM-Scan-Virus: ClamAV says the message is clean +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sun, 15 Apr 2012 17:38:56 -0000 + + +On Fri, 17 Feb 2012, Daniel Schoepe 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@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch -- 2.26.2