Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 5d / 823d380b279d039dbf10c2c4156115daee1564
1 Return-Path: <dme@heart-of-gold.hh.sledj.net>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 1027D431FCB\r
6         for <notmuch@notmuchmail.org>; Fri, 31 Oct 2014 01:05:34 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.379\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.379 tagged_above=-999 required=5\r
12         tests=[NO_DNS_FOR_FROM=0.379] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id lS2oFQKIqFp6 for <notmuch@notmuchmail.org>;\r
16         Fri, 31 Oct 2014 01:05:30 -0700 (PDT)\r
17 Received: from heart-of-gold.hh.sledj.net (disaster-area.hh.sledj.net\r
18         [81.149.164.25])\r
19         by olra.theworths.org (Postfix) with ESMTP id E7C9C431FC2\r
20         for <notmuch@notmuchmail.org>; Fri, 31 Oct 2014 01:05:29 -0700 (PDT)\r
21 Received: by heart-of-gold.hh.sledj.net (Postfix, from userid 501)\r
22         id 4FFAD1670FA4; Fri, 31 Oct 2014 08:05:21 +0000 (GMT)\r
23 From: David Edmondson <dme@dme.org>\r
24 To: notmuch@notmuchmail.org\r
25 Subject: [PATCH v1 1/2] emacs: More flexible washed faces.\r
26 Date: Fri, 31 Oct 2014 08:05:20 +0000\r
27 Message-Id: <1414742721-22561-2-git-send-email-dme@dme.org>\r
28 X-Mailer: git-send-email 1.9.3 (Apple Git-50)\r
29 In-Reply-To: <1414742721-22561-1-git-send-email-dme@dme.org>\r
30 References: <1414742721-22561-1-git-send-email-dme@dme.org>\r
31 X-BeenThere: notmuch@notmuchmail.org\r
32 X-Mailman-Version: 2.1.13\r
33 Precedence: list\r
34 List-Id: "Use and development of the notmuch mail system."\r
35         <notmuch.notmuchmail.org>\r
36 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
37         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
38 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
39 List-Post: <mailto:notmuch@notmuchmail.org>\r
40 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
41 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
42         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
43 X-List-Received-Date: Fri, 31 Oct 2014 08:05:34 -0000\r
44 \r
45 The faces used when washing messages should be notmuch specific and\r
46 inherit from the underlying emacs face rather than using it\r
47 directly. This allows the washed face to be modified without requiring\r
48 the modification of the underlying face.\r
49 ---\r
50  emacs/notmuch-wash.el | 21 +++++++++++++++++++--\r
51  1 file changed, 19 insertions(+), 2 deletions(-)\r
52 \r
53 diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el\r
54 index 8fe91e1..1844400 100644\r
55 --- a/emacs/notmuch-wash.el\r
56 +++ b/emacs/notmuch-wash.el\r
57 @@ -27,6 +27,10 @@\r
58  \r
59  ;;\r
60  \r
61 +(defgroup notmuch-wash nil\r
62 +  "Cleaning up messages for display."\r
63 +  :group 'notmuch)\r
64 +\r
65  (defvar notmuch-wash-signature-regexp\r
66    "^\\(-- ?\\|_+\\)$"\r
67    "Pattern to match a line that separates content from signature.")\r
68 @@ -95,6 +99,19 @@ current window. If this is a number, lines will be wrapped after\r
69  this many characters or at the window width (whichever one is\r
70  lower).")\r
71  \r
72 +(defface notmuch-wash-toggle-button\r
73 +  '((t (:inherit font-lock-comment-face)))\r
74 +  "Face used for buttons toggling the visibility of washed away\r
75 +message parts."\r
76 +  :group 'notmuch-wash\r
77 +  :group 'notmuch-faces)\r
78 +\r
79 +(defface notmuch-wash-cited-text\r
80 +  '((t (:inherit message-cited-text)))\r
81 +  "Face used for cited text."\r
82 +  :group 'notmuch-wash\r
83 +  :group 'notmuch-faces)\r
84 +\r
85  (defun notmuch-wash-toggle-invisible-action (cite-button)\r
86    ;; Toggle overlay visibility\r
87    (let ((overlay (button-get cite-button 'overlay)))\r
88 @@ -117,7 +134,7 @@ lower).")\r
89  (define-button-type 'notmuch-wash-button-invisibility-toggle-type\r
90    'action 'notmuch-wash-toggle-invisible-action\r
91    'follow-link t\r
92 -  'face 'font-lock-comment-face\r
93 +  'face 'notmuch-wash-toggle-button\r
94    :supertype 'notmuch-button-type)\r
95  \r
96  (define-button-type 'notmuch-wash-button-citation-toggle-type\r
97 @@ -192,7 +209,7 @@ that PREFIX should not include a newline."\r
98      (let* ((cite-start (match-beginning 0))\r
99            (cite-end (match-end 0))\r
100            (cite-lines (count-lines cite-start cite-end)))\r
101 -      (overlay-put (make-overlay cite-start cite-end) 'face 'message-cited-text)\r
102 +      (overlay-put (make-overlay cite-start cite-end) 'face 'notmuch-wash-cited-text)\r
103        (when (> cite-lines (+ notmuch-wash-citation-lines-prefix\r
104                              notmuch-wash-citation-lines-suffix\r
105                              1))\r
106 -- \r
107 1.9.3 (Apple Git-50)\r
108 \r