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 F30BD431FBC
\r
6 for <notmuch@notmuchmail.org>; Mon, 30 Jan 2012 02:16:08 -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 48w11HhteSxn for <notmuch@notmuchmail.org>;
\r
16 Mon, 30 Jan 2012 02:16:08 -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 D532D431E64
\r
21 for <notmuch@notmuchmail.org>; Mon, 30 Jan 2012 02:16:07 -0800 (PST)
\r
22 Received: by wibhi8 with SMTP id hi8so3434902wib.26
\r
23 for <notmuch@notmuchmail.org>; Mon, 30 Jan 2012 02:16:06 -0800 (PST)
\r
24 Received: by 10.180.97.199 with SMTP id ec7mr26219180wib.8.1327918566553;
\r
25 Mon, 30 Jan 2012 02:16:06 -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 q7sm29092186wix.5.2012.01.30.02.16.04
\r
29 (version=TLSv1/SSLv3 cipher=OTHER);
\r
30 Mon, 30 Jan 2012 02:16:05 -0800 (PST)
\r
31 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)
\r
32 id 16953A0CEE; Mon, 30 Jan 2012 10:16:03 +0000 (GMT)
\r
33 From: David Edmondson <dme@dme.org>
\r
34 To: notmuch@notmuchmail.org
\r
35 Subject: [PATCH 2/2 v2] emacs: Prefer '[No Subject]' to blank subjects.
\r
36 Date: Mon, 30 Jan 2012 10:16:01 +0000
\r
37 Message-Id: <1327918561-16245-3-git-send-email-dme@dme.org>
\r
38 X-Mailer: git-send-email 1.7.8.3
\r
39 In-Reply-To: <1327918561-16245-1-git-send-email-dme@dme.org>
\r
40 References: <1327496913-4946-1-git-send-email-dme@dme.org>
\r
41 <1327918561-16245-1-git-send-email-dme@dme.org>
\r
42 X-BeenThere: notmuch@notmuchmail.org
\r
43 X-Mailman-Version: 2.1.13
\r
45 List-Id: "Use and development of the notmuch mail system."
\r
46 <notmuch.notmuchmail.org>
\r
47 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
48 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
49 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
50 List-Post: <mailto:notmuch@notmuchmail.org>
\r
51 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
52 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
53 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
54 X-List-Received-Date: Mon, 30 Jan 2012 10:16:09 -0000
\r
57 emacs/notmuch-lib.el | 9 +++++++++
\r
58 emacs/notmuch-print.el | 8 ++++++--
\r
59 emacs/notmuch-show.el | 5 ++++-
\r
60 emacs/notmuch.el | 21 +++++++++------------
\r
61 4 files changed, 28 insertions(+), 15 deletions(-)
\r
63 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
\r
64 index c906ca7..d315f76 100644
\r
65 --- a/emacs/notmuch-lib.el
\r
66 +++ b/emacs/notmuch-lib.el
\r
67 @@ -133,6 +133,15 @@ the user hasn't set this variable with the old or new value."
\r
69 (kill-buffer (current-buffer)))
\r
71 +(defun notmuch-prettify-subject (subject)
\r
72 + ;; This function is used by `notmuch-search-process-filter' which
\r
73 + ;; requires that we not disrupt its' matching state.
\r
76 + (string-match "^[ \t]*$" subject))
\r
82 (defun notmuch-common-do-stash (text)
\r
83 diff --git a/emacs/notmuch-print.el b/emacs/notmuch-print.el
\r
84 index 880f96d..6653d97 100644
\r
85 --- a/emacs/notmuch-print.el
\r
86 +++ b/emacs/notmuch-print.el
\r
89 ;; Authors: David Edmondson <dme@dme.org>
\r
91 +(require 'notmuch-lib)
\r
93 (declare-function notmuch-show-get-prop "notmuch-show" (prop &optional props))
\r
95 (defcustom notmuch-print-mechanism 'notmuch-print-lpr
\r
96 @@ -58,14 +60,16 @@ Optional OUTPUT allows passing a list of flags to muttprint."
\r
98 (defun notmuch-print-ps-print (msg)
\r
99 "Print a message buffer using the ps-print package."
\r
100 - (let ((subject (plist-get (notmuch-show-get-prop :headers msg) :Subject)))
\r
101 + (let ((subject (notmuch-prettify-subject
\r
102 + (plist-get (notmuch-show-get-prop :headers msg) :Subject))))
\r
103 (rename-buffer subject t)
\r
104 (ps-print-buffer)))
\r
106 (defun notmuch-print-ps-print/evince (msg)
\r
107 "Preview a message buffer using ps-print and evince."
\r
108 (let ((ps-file (make-temp-file "notmuch"))
\r
109 - (subject (plist-get (notmuch-show-get-prop :headers msg) :Subject)))
\r
110 + (subject (notmuch-prettify-subject
\r
111 + (plist-get (notmuch-show-get-prop :headers msg) :Subject))))
\r
112 (rename-buffer subject t)
\r
113 (ps-print-buffer ps-file)
\r
114 (notmuch-print-run-evince ps-file)))
\r
115 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
116 index 84ac624..7ea9ba2 100644
\r
117 --- a/emacs/notmuch-show.el
\r
118 +++ b/emacs/notmuch-show.el
\r
119 @@ -1017,7 +1017,7 @@ buffer."
\r
120 (notmuch-show-next-open-message))
\r
122 ;; Set the header line to the subject of the first open message.
\r
123 - (setq header-line-format (notmuch-show-strip-re (notmuch-show-get-subject)))
\r
124 + (setq header-line-format (notmuch-show-strip-re (notmuch-show-get-pretty-subject)))
\r
126 (notmuch-show-mark-read)))
\r
128 @@ -1248,6 +1248,9 @@ Some useful entries are:
\r
129 (defun notmuch-show-get-depth ()
\r
130 (notmuch-show-get-prop :depth))
\r
132 +(defun notmuch-show-get-pretty-subject ()
\r
133 + (notmuch-prettify-subject (notmuch-show-get-subject)))
\r
135 (defun notmuch-show-set-tags (tags)
\r
136 "Set the tags of the current message."
\r
137 (notmuch-show-set-prop :tags tags)
\r
138 diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
139 index d4d6904..2b0a752 100644
\r
140 --- a/emacs/notmuch.el
\r
141 +++ b/emacs/notmuch.el
\r
142 @@ -467,18 +467,14 @@ Complete list of currently available key bindings:
\r
143 "Display the currently selected thread."
\r
145 (let ((thread-id (notmuch-search-find-thread-id))
\r
146 - (subject (notmuch-search-find-subject)))
\r
147 + (subject (notmuch-prettify-subject (notmuch-search-find-subject))))
\r
148 (if (> (length thread-id) 0)
\r
150 - (if (string-match "^[ \t]*$" subject)
\r
151 - (setq subject "[No Subject]"))
\r
153 - (notmuch-show thread-id
\r
155 - notmuch-search-query-string
\r
156 - ;; Name the buffer based on the subject.
\r
157 - (concat "*" (truncate-string-to-width subject 30 nil nil t) "*")
\r
159 + (notmuch-show thread-id
\r
161 + notmuch-search-query-string
\r
162 + ;; Name the buffer based on the subject.
\r
163 + (concat "*" (truncate-string-to-width subject 30 nil nil t) "*")
\r
165 (message "End of search results."))))
\r
167 (defun notmuch-search-reply-to-thread (&optional prompt-for-sender)
\r
168 @@ -854,7 +850,8 @@ non-authors is found, assume that all of the authors match."
\r
169 (if (/= (match-beginning 1) line)
\r
170 (insert (concat "Error: Unexpected output from notmuch search:\n" (substring string line (match-beginning 1)) "\n")))
\r
171 (let ((beg (point)))
\r
172 - (notmuch-search-show-result date count authors subject tags)
\r
173 + (notmuch-search-show-result date count authors
\r
174 + (notmuch-prettify-subject subject) tags)
\r
175 (notmuch-search-color-line beg (point) tag-list)
\r
176 (put-text-property beg (point) 'notmuch-search-thread-id thread-id)
\r
177 (put-text-property beg (point) 'notmuch-search-authors authors)
\r