[PATCH] configure: add --without-api-docs option
[notmuch-archives.git] / 97 / f747bf276ca549265722f3f4c6b49d0aaee767
1 Return-Path: <dme@dme.org>\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 DA631431FAF\r
6         for <notmuch@notmuchmail.org>; Mon,  6 Feb 2012 13:30:24 -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 7Q2ER3I7K1Be for <notmuch@notmuchmail.org>;\r
16         Mon,  6 Feb 2012 13:30:24 -0800 (PST)\r
17 Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com\r
18  [74.125.82.45])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
19  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
20  18EA5431FAE    for <notmuch@notmuchmail.org>; Mon,  6 Feb 2012 13:30:23 -0800\r
21  (PST)\r
22 Received: by wgbdt12 with SMTP id dt12so5834144wgb.2\r
23         for <notmuch@notmuchmail.org>; Mon, 06 Feb 2012 13:30:22 -0800 (PST)\r
24 Received: by 10.180.81.35 with SMTP id w3mr29907332wix.10.1328563822545;\r
25         Mon, 06 Feb 2012 13:30:22 -0800 (PST)\r
26 Received: from hotblack-desiato.hh.sledj.net\r
27         (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25])\r
28         by mx.google.com with ESMTPS id l8sm50143014wiy.5.2012.02.06.13.30.20\r
29         (version=TLSv1/SSLv3 cipher=OTHER);\r
30         Mon, 06 Feb 2012 13:30:21 -0800 (PST)\r
31 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)\r
32         id 55DC1A0484; Mon,  6 Feb 2012 21:30:19 +0000 (GMT)\r
33 From: David Edmondson <dme@dme.org>\r
34 To: notmuch@notmuchmail.org\r
35 Subject: [PATCH] emacs: Leave blank subjects alone by default.\r
36 Date: Mon,  6 Feb 2012 21:30:16 +0000\r
37 Message-Id: <1328563816-12960-1-git-send-email-dme@dme.org>\r
38 X-Mailer: git-send-email 1.7.8.3\r
39 In-Reply-To: <1327496913-4946-1-git-send-email-dme@dme.org>\r
40 References: <1327496913-4946-1-git-send-email-dme@dme.org>\r
41 X-BeenThere: notmuch@notmuchmail.org\r
42 X-Mailman-Version: 2.1.13\r
43 Precedence: list\r
44 List-Id: "Use and development of the notmuch mail system."\r
45         <notmuch.notmuchmail.org>\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
49 List-Post: <mailto:notmuch@notmuchmail.org>\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
53 X-List-Received-Date: Mon, 06 Feb 2012 21:30:25 -0000\r
54 \r
55 Add `notmuch-blank-subject' to control how empty or whitespace only\r
56 subjects are treated. The default behaviour is to leave them\r
57 alone. The user can choose a string to use as a replacement.\r
58 \r
59 Modify code that cannot handle blank subjects to use a fixed string.\r
60 ---\r
61  emacs/notmuch-lib.el   |   20 +++++++++++++++++---\r
62  emacs/notmuch-print.el |    4 ++--\r
63  emacs/notmuch-show.el  |    2 +-\r
64  emacs/notmuch.el       |    4 ++--\r
65  4 files changed, 22 insertions(+), 8 deletions(-)\r
66 \r
67 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
68 index d315f76..2edc868 100644\r
69 --- a/emacs/notmuch-lib.el\r
70 +++ b/emacs/notmuch-lib.el\r
71 @@ -67,6 +67,13 @@\r
72    :type 'boolean\r
73    :group 'notmuch-search)\r
74  \r
75 +(defcustom notmuch-blank-subject nil\r
76 +  "How should subjects that are empty or whitespace only be\r
77 +treated?"\r
78 +  :type '(choice (const :tag "Leave them alone" nil)\r
79 +                (string :tag "Replacement string" "[No Subject]"))\r
80 +  :group 'notmuch)\r
81 +\r
82  ;;\r
83  \r
84  (defvar notmuch-search-history nil\r
85 @@ -133,13 +140,20 @@ the user hasn't set this variable with the old or new value."\r
86    (interactive)\r
87    (kill-buffer (current-buffer)))\r
88  \r
89 -(defun notmuch-prettify-subject (subject)\r
90 +(defun notmuch-pretty-non-empty-subject (subject)\r
91 +  (let ((subject (notmuch-pretty-subject subject)))\r
92 +    (if (string-match "^[ \t]*$" subject)\r
93 +       "no subject"\r
94 +      subject)))\r
95 +\r
96 +(defun notmuch-pretty-subject (subject)\r
97    ;; This function is used by `notmuch-search-process-filter' which\r
98    ;; requires that we not disrupt its' matching state.\r
99    (save-match-data\r
100 -    (if (and subject\r
101 +    (if (and (stringp notmuch-blank-subject)\r
102 +            subject\r
103              (string-match "^[ \t]*$" subject))\r
104 -       "[No Subject]"\r
105 +       notmuch-blank-subject\r
106        subject)))\r
107  \r
108  ;;\r
109 diff --git a/emacs/notmuch-print.el b/emacs/notmuch-print.el\r
110 index 6653d97..dda082a 100644\r
111 --- a/emacs/notmuch-print.el\r
112 +++ b/emacs/notmuch-print.el\r
113 @@ -60,7 +60,7 @@ Optional OUTPUT allows passing a list of flags to muttprint."\r
114  \r
115  (defun notmuch-print-ps-print (msg)\r
116    "Print a message buffer using the ps-print package."\r
117 -  (let ((subject (notmuch-prettify-subject\r
118 +  (let ((subject (notmuch-pretty-non-empty-subject\r
119                   (plist-get (notmuch-show-get-prop :headers msg) :Subject))))\r
120      (rename-buffer subject t)\r
121      (ps-print-buffer)))\r
122 @@ -68,7 +68,7 @@ Optional OUTPUT allows passing a list of flags to muttprint."\r
123  (defun notmuch-print-ps-print/evince (msg)\r
124    "Preview a message buffer using ps-print and evince."\r
125    (let ((ps-file (make-temp-file "notmuch"))\r
126 -       (subject (notmuch-prettify-subject\r
127 +       (subject (notmuch-pretty-non-empty-subject\r
128                   (plist-get (notmuch-show-get-prop :headers msg) :Subject))))\r
129      (rename-buffer subject t)\r
130      (ps-print-buffer ps-file)\r
131 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
132 index 7469e2e..4a23cc2 100644\r
133 --- a/emacs/notmuch-show.el\r
134 +++ b/emacs/notmuch-show.el\r
135 @@ -1261,7 +1261,7 @@ Some useful entries are:\r
136    (notmuch-show-get-prop :depth))\r
137  \r
138  (defun notmuch-show-get-pretty-subject ()\r
139 -  (notmuch-prettify-subject (notmuch-show-get-subject)))\r
140 +  (notmuch-pretty-subject (notmuch-show-get-subject)))\r
141  \r
142  (defun notmuch-show-set-tags (tags)\r
143    "Set the tags of the current message."\r
144 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
145 index cd04ffd..aab6946 100644\r
146 --- a/emacs/notmuch.el\r
147 +++ b/emacs/notmuch.el\r
148 @@ -467,7 +467,7 @@ Complete list of currently available key bindings:\r
149    "Display the currently selected thread."\r
150    (interactive "P")\r
151    (let ((thread-id (notmuch-search-find-thread-id))\r
152 -       (subject (notmuch-prettify-subject (notmuch-search-find-subject))))\r
153 +       (subject (notmuch-pretty-non-empty-subject (notmuch-search-find-subject))))\r
154      (if (> (length thread-id) 0)\r
155         (notmuch-show thread-id\r
156                       (current-buffer)\r
157 @@ -850,7 +850,7 @@ non-authors is found, assume that all of the authors match."\r
158                           (insert (concat "Error: Unexpected output from notmuch search:\n" (substring string line (match-beginning 1)) "\n")))\r
159                       (let ((beg (point)))\r
160                         (notmuch-search-show-result date count authors\r
161 -                                                   (notmuch-prettify-subject subject) tags)\r
162 +                                                   (notmuch-pretty-subject subject) tags)\r
163                         (notmuch-search-color-line beg (point) tag-list)\r
164                         (put-text-property beg (point) 'notmuch-search-thread-id thread-id)\r
165                         (put-text-property beg (point) 'notmuch-search-authors authors)\r
166 -- \r
167 1.7.8.3\r
168 \r