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