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 F0D20431FAE
\r
6 for <notmuch@notmuchmail.org>; Mon, 6 Feb 2012 14:48:16 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 JQr78VRo6hQP for <notmuch@notmuchmail.org>;
\r
16 Mon, 6 Feb 2012 14:48:16 -0800 (PST)
\r
17 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com
\r
18 [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 24DE5431FAF
\r
21 for <notmuch@notmuchmail.org>; Mon, 6 Feb 2012 14:48:16 -0800 (PST)
\r
22 Received: by wibhi8 with SMTP id hi8so5233207wib.26
\r
23 for <notmuch@notmuchmail.org>; Mon, 06 Feb 2012 14:48:14 -0800 (PST)
\r
25 Received: by 10.180.83.72 with SMTP id o8mr15738278wiy.22.1328568494828;
\r
26 Mon, 06 Feb 2012 14:48:14 -0800 (PST)
\r
27 Received: from hotblack-desiato.hh.sledj.net
\r
28 (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25])
\r
29 by mx.google.com with ESMTPS id q7sm28301251wix.5.2012.02.06.14.48.12
\r
30 (version=TLSv1/SSLv3 cipher=OTHER);
\r
31 Mon, 06 Feb 2012 14:48:13 -0800 (PST)
\r
32 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)
\r
33 id AECCDA0484; Mon, 6 Feb 2012 22:48:11 +0000 (GMT)
\r
34 From: David Edmondson <dme@dme.org>
\r
35 To: notmuch@notmuchmail.org
\r
36 Subject: [PATCH v2] emacs: Leave blank subjects alone by default.
\r
37 Date: Mon, 6 Feb 2012 22:48:10 +0000
\r
38 Message-Id: <1328568490-18473-1-git-send-email-dme@dme.org>
\r
39 X-Mailer: git-send-email 1.7.8.3
\r
40 In-Reply-To: <1327496913-4946-1-git-send-email-dme@dme.org>
\r
41 References: <1327496913-4946-1-git-send-email-dme@dme.org>
\r
43 ALoCoQnJ5S+zRen+b2BZ+tnZ1DuejA+lTXRrTPrwrOy79c+Lda1w0T4Pgld6f7CNtsPK/ZLcblXV
\r
44 X-BeenThere: notmuch@notmuchmail.org
\r
45 X-Mailman-Version: 2.1.13
\r
47 List-Id: "Use and development of the notmuch mail system."
\r
48 <notmuch.notmuchmail.org>
\r
49 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
51 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
52 List-Post: <mailto:notmuch@notmuchmail.org>
\r
53 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
54 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
56 X-List-Received-Date: Mon, 06 Feb 2012 22:48:17 -0000
\r
58 Add `notmuch-blank-subject' to control how empty or whitespace only
\r
59 subjects are treated. The default behaviour is to leave them
\r
60 alone. The user can choose a string to use as a replacement.
\r
62 Modify code that cannot handle blank subjects to use a fixed string.
\r
65 Fix the non-string subject case (again, sigh).
\r
67 emacs/notmuch-lib.el | 21 ++++++++++++++++++---
\r
68 emacs/notmuch-print.el | 4 ++--
\r
69 emacs/notmuch-show.el | 2 +-
\r
70 emacs/notmuch.el | 4 ++--
\r
71 4 files changed, 23 insertions(+), 8 deletions(-)
\r
73 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
\r
74 index d315f76..95e3c29 100644
\r
75 --- a/emacs/notmuch-lib.el
\r
76 +++ b/emacs/notmuch-lib.el
\r
79 :group 'notmuch-search)
\r
81 +(defcustom notmuch-blank-subject nil
\r
82 + "How should subjects that are empty or whitespace only be
\r
84 + :type '(choice (const :tag "Leave them alone" nil)
\r
85 + (string :tag "Replacement string" "[No Subject]"))
\r
90 (defvar notmuch-search-history nil
\r
91 @@ -133,13 +140,21 @@ the user hasn't set this variable with the old or new value."
\r
93 (kill-buffer (current-buffer)))
\r
95 -(defun notmuch-prettify-subject (subject)
\r
96 +(defun notmuch-pretty-non-empty-subject (subject)
\r
97 + (let ((subject (notmuch-pretty-subject subject)))
\r
99 + (string-match "^[ \t]*$" subject))
\r
103 +(defun notmuch-pretty-subject (subject)
\r
104 ;; This function is used by `notmuch-search-process-filter' which
\r
105 ;; requires that we not disrupt its' matching state.
\r
108 + (if (and (stringp notmuch-blank-subject)
\r
110 (string-match "^[ \t]*$" subject))
\r
112 + notmuch-blank-subject
\r
116 diff --git a/emacs/notmuch-print.el b/emacs/notmuch-print.el
\r
117 index 6653d97..dda082a 100644
\r
118 --- a/emacs/notmuch-print.el
\r
119 +++ b/emacs/notmuch-print.el
\r
120 @@ -60,7 +60,7 @@ Optional OUTPUT allows passing a list of flags to muttprint."
\r
122 (defun notmuch-print-ps-print (msg)
\r
123 "Print a message buffer using the ps-print package."
\r
124 - (let ((subject (notmuch-prettify-subject
\r
125 + (let ((subject (notmuch-pretty-non-empty-subject
\r
126 (plist-get (notmuch-show-get-prop :headers msg) :Subject))))
\r
127 (rename-buffer subject t)
\r
128 (ps-print-buffer)))
\r
129 @@ -68,7 +68,7 @@ Optional OUTPUT allows passing a list of flags to muttprint."
\r
130 (defun notmuch-print-ps-print/evince (msg)
\r
131 "Preview a message buffer using ps-print and evince."
\r
132 (let ((ps-file (make-temp-file "notmuch"))
\r
133 - (subject (notmuch-prettify-subject
\r
134 + (subject (notmuch-pretty-non-empty-subject
\r
135 (plist-get (notmuch-show-get-prop :headers msg) :Subject))))
\r
136 (rename-buffer subject t)
\r
137 (ps-print-buffer ps-file)
\r
138 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
139 index 7469e2e..4a23cc2 100644
\r
140 --- a/emacs/notmuch-show.el
\r
141 +++ b/emacs/notmuch-show.el
\r
142 @@ -1261,7 +1261,7 @@ Some useful entries are:
\r
143 (notmuch-show-get-prop :depth))
\r
145 (defun notmuch-show-get-pretty-subject ()
\r
146 - (notmuch-prettify-subject (notmuch-show-get-subject)))
\r
147 + (notmuch-pretty-subject (notmuch-show-get-subject)))
\r
149 (defun notmuch-show-set-tags (tags)
\r
150 "Set the tags of the current message."
\r
151 diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
152 index cd04ffd..aab6946 100644
\r
153 --- a/emacs/notmuch.el
\r
154 +++ b/emacs/notmuch.el
\r
155 @@ -467,7 +467,7 @@ Complete list of currently available key bindings:
\r
156 "Display the currently selected thread."
\r
158 (let ((thread-id (notmuch-search-find-thread-id))
\r
159 - (subject (notmuch-prettify-subject (notmuch-search-find-subject))))
\r
160 + (subject (notmuch-pretty-non-empty-subject (notmuch-search-find-subject))))
\r
161 (if (> (length thread-id) 0)
\r
162 (notmuch-show thread-id
\r
164 @@ -850,7 +850,7 @@ non-authors is found, assume that all of the authors match."
\r
165 (insert (concat "Error: Unexpected output from notmuch search:\n" (substring string line (match-beginning 1)) "\n")))
\r
166 (let ((beg (point)))
\r
167 (notmuch-search-show-result date count authors
\r
168 - (notmuch-prettify-subject subject) tags)
\r
169 + (notmuch-pretty-subject subject) tags)
\r
170 (notmuch-search-color-line beg (point) tag-list)
\r
171 (put-text-property beg (point) 'notmuch-search-thread-id thread-id)
\r
172 (put-text-property beg (point) 'notmuch-search-authors authors)
\r