[PATCH] emacs: Add configurable wrapping width for notmuch-wash-wrap-long-lines
authorDaniel Schoepe <daniel@schoepe.org>
Fri, 17 Feb 2012 18:34:44 +0000 (19:34 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:44:38 +0000 (09:44 -0800)
b5/011a2042a2aed68aa304b4910cabcf982f672b [new file with mode: 0644]

diff --git a/b5/011a2042a2aed68aa304b4910cabcf982f672b b/b5/011a2042a2aed68aa304b4910cabcf982f672b
new file mode 100644 (file)
index 0000000..98ad75d
--- /dev/null
@@ -0,0 +1,124 @@
+Return-Path: <daniel@schoepe.org>\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 79D5B429E42\r
+       for <notmuch@notmuchmail.org>; Fri, 17 Feb 2012 10:34:53 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.8\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.8 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       RCVD_IN_DNSWL_LOW=-0.7] 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 bZ1sqR3LN4bt for <notmuch@notmuchmail.org>;\r
+       Fri, 17 Feb 2012 10:34:51 -0800 (PST)\r
+Received: from mail-ey0-f181.google.com (mail-ey0-f181.google.com\r
+       [209.85.215.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 165EA431FB6\r
+       for <notmuch@notmuchmail.org>; Fri, 17 Feb 2012 10:34:50 -0800 (PST)\r
+Received: by eaak14 with SMTP id k14so1918814eaa.26\r
+       for <notmuch@notmuchmail.org>; Fri, 17 Feb 2012 10:34:49 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=schoepe.org; s=google;\r
+       h=mime-version:from:to:cc:subject:date:message-id:x-mailer;\r
+       bh=h2BZOCeEi4RdB8abW5q+FRqFt6+u6k/HBd0HVQJtmCg=;\r
+       b=XzWraVQ+JS6/huf5AUuopkaX3oFTaH3Bs63Vtf6VoaQj4YqECcyhuMugFxpcsw+3kq\r
+       e77hZbNsqEkTwGRiOZ71Fhjmkpj/tSonA+9OWLHMdIQ3qjVcKiFsB61mcGwZQaNLkAmD\r
+       YMBk6lvHVkxMTc+M3fVRfGPs9xpZvHLzAtw5o=\r
+MIME-Version: 1.0\r
+Received: by 10.14.200.196 with SMTP id z44mr4154759een.116.1329503689606;\r
+       Fri, 17 Feb 2012 10:34:49 -0800 (PST)\r
+Received: from localhost (p4FC797C1.dip0.t-ipconnect.de. [79.199.151.193])\r
+       by mx.google.com with ESMTPS id y14sm11927538eef.10.2012.02.17.10.34.47\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Fri, 17 Feb 2012 10:34:48 -0800 (PST)\r
+From: Daniel Schoepe <daniel@schoepe.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: Add configurable wrapping width for\r
+       notmuch-wash-wrap-long-lines\r
+Date: Fri, 17 Feb 2012 19:34:44 +0100\r
+Message-Id: <1329503684-31289-1-git-send-email-daniel@schoepe.org>\r
+X-Mailer: git-send-email 1.7.9\r
+X-Gm-Message-State:\r
+ ALoCoQkg5cReXLQl+bOZJPssM8xhW3J9d8hVxnidXPsBhYvtrj9+cL582CzGEGibwQCDZxVrut1r\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: Fri, 17 Feb 2012 18:34:53 -0000\r
+\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
+ 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