Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 46 / fcebc16efd6b0f4f333616f851b2bb6f19861b
1 Return-Path: <amdragon@mit.edu>\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 61CA9431FC7\r
6         for <notmuch@notmuchmail.org>; Mon,  4 Feb 2013 13:37:12 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 FTOv7KL7J96V for <notmuch@notmuchmail.org>;\r
16         Mon,  4 Feb 2013 13:37:11 -0800 (PST)\r
17 Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU\r
18         [18.7.68.34])\r
19         by olra.theworths.org (Postfix) with ESMTP id BCD5C431FBC\r
20         for <notmuch@notmuchmail.org>; Mon,  4 Feb 2013 13:37:10 -0800 (PST)\r
21 X-AuditID: 12074422-b7f5c6d000000545-46-51102a06bd23\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
23         by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id C5.EF.01349.60A20115; Mon,  4 Feb 2013 16:37:10 -0500 (EST)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH-1.MIT.EDU [18.9.28.11])\r
26         by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id r14Lb8tA003239; \r
27         Mon, 4 Feb 2013 16:37:08 -0500\r
28 Received: from drake.dyndns.org (26-4-172.dynamic.csail.mit.edu [18.26.4.172])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r14Lb6Q7016772\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Mon, 4 Feb 2013 16:37:07 -0500\r
34 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1U2Tis-0001mw-5k; Mon, 04 Feb 2013 16:37:06 -0500\r
37 From: Austin Clements <amdragon@MIT.EDU>\r
38 To: notmuch@notmuchmail.org\r
39 Subject: [PATCH 2/2] emacs: Combine string faces and combine under existing\r
40         faces\r
41 Date: Mon,  4 Feb 2013 16:37:02 -0500\r
42 Message-Id: <1360013822-6562-3-git-send-email-amdragon@mit.edu>\r
43 X-Mailer: git-send-email 1.7.10.4\r
44 In-Reply-To: <1360013822-6562-1-git-send-email-amdragon@mit.edu>\r
45 References: <1360013822-6562-1-git-send-email-amdragon@mit.edu>\r
46 X-Brightmail-Tracker:\r
47  H4sIAAAAAAAAA+NgFjrBIsWRmVeSWpSXmKPExsUixG6nrsumJRBoMPciv8Wuu1uZLK7fnMns\r
48         wOSxc9Zddo9nq24xBzBFcdmkpOZklqUW6dslcGVsn32SrWCzUMXiJ1YNjA/5uhg5OSQETCTm\r
49         Te1lg7DFJC7cWw9kc3EICexjlPg2dw8zhLOBUWLK8o+MEM5hJom+Z9PZIZy5jBJtc2ezg/Sz\r
50         CWhIbNu/nBHEFhGQlth5dzYriM0sYC+xcdZrsBphgUCJBdd+MYPYLAKqEt/6V4PZvEA1bW8m\r
51         QN2hKNH9DMTm4OAUcJC4u4oHJCwEVPLu4nzGCYz8CxgZVjHKpuRW6eYmZuYUpybrFicn5uWl\r
52         Fuma6uVmluilppRuYgQHkovSDsafB5UOMQpwMCrx8AZe4w8UYk0sK67MPcQoycGkJMpbpCQQ\r
53         KMSXlJ9SmZFYnBFfVJqTWnyIUYKDWUmE9+MNoHLelMTKqtSifJiUNAeLkjjvtZSb/kIC6Ykl\r
54         qdmpqQWpRTBZGQ4OJQleH02goYJFqempFWmZOSUIaSYOTpDhPEDDDUFqeIsLEnOLM9Mh8qcY\r
55         dTn2P2l/zijEkpeflyolzisOUiQAUpRRmgc3B5YAXjGKA70lzGsEUsUDTB5wk14BLWECWqKU\r
56         A/JBcUkiQkqqgVHvVorPgZANApWyTxN7KmJefSzhkywubrydU1zm8t5+uXNUVE7fgvlFOtIf\r
57         tZ2sfV9zl57oyZ7jt9YmT8RQ/mH9oe4vGnFvTneeNfHdHpedmHA/9fuVpfrbIzgtfXyfWe8N\r
58         OjXvZnjMe44Xuk49K/pPfT08822ksf7eY5Z+874VWF2Jfj8tWYmlOCPRUIu5qDgRACO7GLzb        AgAA\r
59 X-BeenThere: notmuch@notmuchmail.org\r
60 X-Mailman-Version: 2.1.13\r
61 Precedence: list\r
62 List-Id: "Use and development of the notmuch mail system."\r
63         <notmuch.notmuchmail.org>\r
64 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
65         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
66 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
67 List-Post: <mailto:notmuch@notmuchmail.org>\r
68 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
69 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
70         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
71 X-List-Received-Date: Mon, 04 Feb 2013 21:37:13 -0000\r
72 \r
73 This improves notmuch-combine-face-text-property to support both\r
74 applying faces to strings and to support combining the given face\r
75 under existing faces, rather than over.\r
76 ---\r
77  emacs/notmuch-lib.el |   21 +++++++++++++--------\r
78  1 file changed, 13 insertions(+), 8 deletions(-)\r
79 \r
80 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
81 index ad2816d..7c8816d 100644\r
82 --- a/emacs/notmuch-lib.el\r
83 +++ b/emacs/notmuch-lib.el\r
84 @@ -311,13 +311,16 @@ single element face list."\r
85        face\r
86      (list face)))\r
87  \r
88 -(defun notmuch-combine-face-text-property (start end face)\r
89 +(defun notmuch-combine-face-text-property (start end face &optional below object)\r
90    "Combine FACE into the 'face text property between START and END.\r
91  \r
92  This function combines FACE with any existing faces between START\r
93 -and END.  Attributes specified by FACE take precedence over\r
94 -existing attributes.  FACE must be a face name (a symbol or\r
95 -string), a property list of face attributes, or a list of these."\r
96 +and END in OBJECT (which defaults to the current buffer).\r
97 +Attributes specified by FACE take precedence over existing\r
98 +attributes unless BELOW is non-nil.  FACE must be a face name (a\r
99 +symbol or string), a property list of face attributes, or a list\r
100 +of these.  For convenience when applied to strings, this returns\r
101 +OBJECT."\r
102  \r
103    ;; A face property can have three forms: a face name (a string or\r
104    ;; symbol), a property list, or a list of these two forms.  In the\r
105 @@ -327,13 +330,15 @@ string), a property list of face attributes, or a list of these."\r
106    (let ((pos start)\r
107         (face-list (notmuch-face-ensure-list-form face)))\r
108      (while (< pos end)\r
109 -      (let* ((cur (get-text-property pos 'face))\r
110 +      (let* ((cur (get-text-property pos 'face object))\r
111              (cur-list (notmuch-face-ensure-list-form cur))\r
112              (new (cond ((null cur-list) face)\r
113 +                       (below (append cur-list face-list))\r
114                         (t (append face-list cur-list))))\r
115 -            (next (next-single-property-change pos 'face nil end)))\r
116 -       (put-text-property pos next 'face new)\r
117 -       (setq pos next)))))\r
118 +            (next (next-single-property-change pos 'face object end)))\r
119 +       (put-text-property pos next 'face new object)\r
120 +       (setq pos next))))\r
121 +  object)\r
122  \r
123  (defun notmuch-logged-error (msg &optional extra)\r
124    "Log MSG and EXTRA to *Notmuch errors* and signal MSG.\r
125 -- \r
126 1.7.10.4\r
127 \r