Re: [PATCH] emacs: Add configurable wrapping width for notmuch-wash-wrap-long-lines
authorMark Walters <markwalters1009@gmail.com>
Sun, 15 Apr 2012 17:39:12 +0000 (18:39 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:46:26 +0000 (09:46 -0800)
2f/b54d2e3826ff743a66aafe11983f027f30c3b9 [new file with mode: 0644]

diff --git a/2f/b54d2e3826ff743a66aafe11983f027f30c3b9 b/2f/b54d2e3826ff743a66aafe11983f027f30c3b9
new file mode 100644 (file)
index 0000000..aa5a213
--- /dev/null
@@ -0,0 +1,160 @@
+Return-Path: <m.walters@qmul.ac.uk>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id B34AC431FAF\r
+       for <notmuch@notmuchmail.org>; Sun, 15 Apr 2012 10:38:56 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.098\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
+       tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+       NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id R6lfBofc0Khi for <notmuch@notmuchmail.org>;\r
+       Sun, 15 Apr 2012 10:38:55 -0700 (PDT)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 7812A431FAE\r
+       for <notmuch@notmuchmail.org>; Sun, 15 Apr 2012 10:38:55 -0700 (PDT)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+       by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+       (envelope-from <m.walters@qmul.ac.uk>)\r
+       id 1SJTPZ-0001OA-Bk; Sun, 15 Apr 2012 18:38:54 +0100\r
+Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223]\r
+       helo=localhost)\r
+       by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)\r
+       (envelope-from <m.walters@qmul.ac.uk>)\r
+       id 1SJTPZ-0003EU-06; Sun, 15 Apr 2012 18:38:53 +0100\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Daniel Schoepe <daniel@schoepe.org>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] emacs: Add configurable wrapping width for\r
+       notmuch-wash-wrap-long-lines\r
+In-Reply-To: <1329503684-31289-1-git-send-email-daniel@schoepe.org>\r
+References: <1329503684-31289-1-git-send-email-daniel@schoepe.org>\r
+User-Agent: Notmuch/0.12+110~gbc97b4a (http://notmuchmail.org) Emacs/23.3.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Sun, 15 Apr 2012 18:39:12 +0100\r
+Message-ID: <87fwc46gjj.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Sender-Host-Address: 94.192.233.223\r
+X-QM-SPAM-Info: Sender has good ham record.  :)\r
+X-QM-Body-MD5: 1c166aab3b4dd4b43bfaa2dbbffba692 (of first 20000 bytes)\r
+X-SpamAssassin-Score: -1.8\r
+X-SpamAssassin-SpamBar: -\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+       determine if it is\r
+       spam. We require at least 5.0 points to mark a message as spam.\r
+       This message scored -1.8 points.\r
+       Summary of the scoring: \r
+       * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\r
+       *      medium trust\r
+       *      [138.37.6.40 listed in list.dnswl.org]\r
+       * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+       provider *      (markwalters1009[at]gmail.com)\r
+       * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
+       *      domain\r
+       *  0.5 AWL AWL: From: address is in the auto white-list\r
+X-QM-Scan-Virus: ClamAV says the message is clean\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 15 Apr 2012 17:38:56 -0000\r
+\r
+\r
+On Fri, 17 Feb 2012, Daniel Schoepe <daniel@schoepe.org> wrote:\r
+> This introduces a variable to control after how many characters a line\r
+> is wrapped by notmuch-wash-wrap-long-lines (still wrapping at the\r
+> window width if it is lower).\r
+\r
+Hi \r
+\r
+This looks ok but I wonder if slightly different behaviour might be\r
+preferable (and looks simple to implement): rather then always wrapping\r
+at min of notmuch-wash-wrap-lines-length and window-width wrap at min of\r
+(notmuch-wash-wrap-lines-length + depth) and window-width. Then if you\r
+have a wide buffer you can still get 80 chars (say) of useful text even\r
+for well nested messages whilst not having very long lines anywhere.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+> ---\r
+>  emacs/notmuch-wash.el |   36 ++++++++++++++++++++++++++----------\r
+>  1 files changed, 26 insertions(+), 10 deletions(-)\r
+>\r
+> diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el\r
+> index 56981d0..7d003a2 100644\r
+> --- a/emacs/notmuch-wash.el\r
+> +++ b/emacs/notmuch-wash.el\r
+> @@ -87,6 +87,14 @@ If there is one more line than the sum of\r
+>  `notmuch-wash-citation-lines-suffix', show that, otherwise\r
+>  collapse the remaining lines into a button.")\r
+>  \r
+> +(defvar notmuch-wash-wrap-lines-length nil\r
+> +  "Wrap line after at most this many characters.\r
+> +\r
+> +If this is nil, lines in messages will be wrapped to fit in the\r
+> +current window. If this is a number, lines will be wrapped after\r
+> +this many characters or at the window width (whichever one is\r
+> +lower).")\r
+> +\r
+>  (defun notmuch-wash-toggle-invisible-action (cite-button)\r
+>    (let ((invis-spec (button-get cite-button 'invisibility-spec)))\r
+>      (if (invisible-p invis-spec)\r
+> @@ -276,16 +284,24 @@ Perform several transformations on the message body:\r
+>  ;;\r
+>  \r
+>  (defun notmuch-wash-wrap-long-lines (msg depth)\r
+> -  "Wrap any long lines in the message to the width of the window.\r
+> -\r
+> -When doing so, maintaining citation leaders in the wrapped text."\r
+> -\r
+> -  (let ((coolj-wrap-follows-window-size nil)\r
+> -    (fill-column (- (window-width)\r
+> -                    depth\r
+> -                    ;; 2 to avoid poor interaction with\r
+> -                    ;; `word-wrap'.\r
+> -                    2)))\r
+> +  "Wrap long lines in the message.\r
+> +\r
+> +If `notmuch-wash-wrap-lines-length' is a number, this will wrap\r
+> +the message lines to the minimum of the width of the window or\r
+> +its value. Otherwise, this function will wrap long lines in the\r
+> +message at the window width. When doing so, citation leaders in\r
+> +the wrapped text are maintained."\r
+> +\r
+> +  (let* ((coolj-wrap-follows-window-size nil)\r
+> +     (limit (if (numberp notmuch-wash-wrap-lines-length)\r
+> +                (min notmuch-wash-wrap-lines-length\r
+> +                     (window-width))\r
+> +              (window-width)))\r
+> +     (fill-column (- limit\r
+> +                     depth\r
+> +                     ;; 2 to avoid poor interaction with\r
+> +                     ;; `word-wrap'.\r
+> +                     2)))\r
+>      (coolj-wrap-region (point-min) (point-max))))\r
+>  \r
+>  ;;\r
+> -- \r
+> 1.7.9\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r