--- /dev/null
+Return-Path: <m.walters@qmul.ac.uk>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 239E2431FB6\r
+ for <notmuch@notmuchmail.org>; Sun, 12 Feb 2012 00:50:58 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.098\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
+ tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+ NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id QJj7I8f0jK5w for <notmuch@notmuchmail.org>;\r
+ Sun, 12 Feb 2012 00:50:57 -0800 (PST)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 165A8431FAE\r
+ for <notmuch@notmuchmail.org>; Sun, 12 Feb 2012 00:50:57 -0800 (PST)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+ by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1RwV90-0000EG-37; Sun, 12 Feb 2012 08:50:52 +0000\r
+Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223]\r
+ helo=localhost)\r
+ by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1RwV8z-0005jB-HT; Sun, 12 Feb 2012 08:50:49 +0000\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v2] emacs: Leave blank subjects alone by default.\r
+In-Reply-To: <1328568490-18473-1-git-send-email-dme@dme.org>\r
+References: <1327496913-4946-1-git-send-email-dme@dme.org>\r
+ <1328568490-18473-1-git-send-email-dme@dme.org>\r
+User-Agent: Notmuch/0.11.1+172~g6a5d2c5 (http://notmuchmail.org) Emacs/23.2.1\r
+ (i486-pc-linux-gnu)\r
+Date: Sun, 12 Feb 2012 08:52:08 +0000\r
+Message-ID: <87wr7se8nb.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Sender-Host-Address: 94.192.233.223\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: 4034b24d4e93177b2872c297aa069a8d (of first 20000 bytes)\r
+X-SpamAssassin-Score: -1.8\r
+X-SpamAssassin-SpamBar: -\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+ determine if it is\r
+ spam. We require at least 5.0 points to mark a message as spam.\r
+ This message scored -1.8 points.\r
+ Summary of the scoring: \r
+ * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\r
+ * medium trust\r
+ * [138.37.6.40 listed in list.dnswl.org]\r
+ * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+ provider * (markwalters1009[at]gmail.com)\r
+ * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
+ * domain\r
+ * 0.5 AWL AWL: From: address is in the auto white-list\r
+X-QM-Scan-Virus: ClamAV says the message is clean\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 12 Feb 2012 08:50:58 -0000\r
+\r
+On Mon, 6 Feb 2012 22:48:10 +0000, David Edmondson <dme@dme.org> wrote:\r
+> Add `notmuch-blank-subject' to control how empty or whitespace only\r
+> subjects are treated. The default behaviour is to leave them\r
+> alone. The user can choose a string to use as a replacement.\r
+> \r
+> Modify code that cannot handle blank subjects to use a fixed string.\r
+> ---\r
+> \r
+> Fix the non-string subject case (again, sigh).\r
+> \r
+> emacs/notmuch-lib.el | 21 ++++++++++++++++++---\r
+> emacs/notmuch-print.el | 4 ++--\r
+> emacs/notmuch-show.el | 2 +-\r
+> emacs/notmuch.el | 4 ++--\r
+> 4 files changed, 23 insertions(+), 8 deletions(-)\r
+> \r
+> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+> index d315f76..95e3c29 100644\r
+> --- a/emacs/notmuch-lib.el\r
+> +++ b/emacs/notmuch-lib.el\r
+> @@ -67,6 +67,13 @@\r
+> :type 'boolean\r
+> :group 'notmuch-search)\r
+> \r
+> +(defcustom notmuch-blank-subject nil\r
+> + "How should subjects that are empty or whitespace only be\r
+> +treated?"\r
+> + :type '(choice (const :tag "Leave them alone" nil)\r
+> + (string :tag "Replacement string" "[No Subject]"))\r
+> + :group 'notmuch)\r
+> +\r
+> ;;\r
+> \r
+> (defvar notmuch-search-history nil\r
+> @@ -133,13 +140,21 @@ the user hasn't set this variable with the old or new value."\r
+> (interactive)\r
+> (kill-buffer (current-buffer)))\r
+> \r
+> -(defun notmuch-prettify-subject (subject)\r
+> +(defun notmuch-pretty-non-empty-subject (subject)\r
+> + (let ((subject (notmuch-pretty-subject subject)))\r
+> + (if (and subject\r
+> + (string-match "^[ \t]*$" subject))\r
+> + "no subject"\r
+> + subject)))\r
+> +\r
+> +(defun notmuch-pretty-subject (subject)\r
+> ;; This function is used by `notmuch-search-process-filter' which\r
+> ;; requires that we not disrupt its' matching state.\r
+> (save-match-data\r
+> - (if (and subject\r
+> + (if (and (stringp notmuch-blank-subject)\r
+> + subject\r
+> (string-match "^[ \t]*$" subject))\r
+> - "[No Subject]"\r
+> + notmuch-blank-subject\r
+> subject)))\r
+\r
+\r
+Hi\r
+\r
+This LGTM but I wonder whether notmuch-pretty-non-empty-subject should\r
+try the defcustom notmuch-blank-subject and only fall back to "no\r
+subject" if not set? (Of course then someone will want an option to\r
+customise the string in print but not in search....)\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+> \r
+> ;;\r
+> diff --git a/emacs/notmuch-print.el b/emacs/notmuch-print.el\r
+> index 6653d97..dda082a 100644\r
+> --- a/emacs/notmuch-print.el\r
+> +++ b/emacs/notmuch-print.el\r
+> @@ -60,7 +60,7 @@ Optional OUTPUT allows passing a list of flags to muttprint."\r
+> \r
+> (defun notmuch-print-ps-print (msg)\r
+> "Print a message buffer using the ps-print package."\r
+> - (let ((subject (notmuch-prettify-subject\r
+> + (let ((subject (notmuch-pretty-non-empty-subject\r
+> (plist-get (notmuch-show-get-prop :headers msg) :Subject))))\r
+> (rename-buffer subject t)\r
+> (ps-print-buffer)))\r
+> @@ -68,7 +68,7 @@ Optional OUTPUT allows passing a list of flags to muttprint."\r
+> (defun notmuch-print-ps-print/evince (msg)\r
+> "Preview a message buffer using ps-print and evince."\r
+> (let ((ps-file (make-temp-file "notmuch"))\r
+> - (subject (notmuch-prettify-subject\r
+> + (subject (notmuch-pretty-non-empty-subject\r
+> (plist-get (notmuch-show-get-prop :headers msg) :Subject))))\r
+> (rename-buffer subject t)\r
+> (ps-print-buffer ps-file)\r
+> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+> index 7469e2e..4a23cc2 100644\r
+> --- a/emacs/notmuch-show.el\r
+> +++ b/emacs/notmuch-show.el\r
+> @@ -1261,7 +1261,7 @@ Some useful entries are:\r
+> (notmuch-show-get-prop :depth))\r
+> \r
+> (defun notmuch-show-get-pretty-subject ()\r
+> - (notmuch-prettify-subject (notmuch-show-get-subject)))\r
+> + (notmuch-pretty-subject (notmuch-show-get-subject)))\r
+> \r
+> (defun notmuch-show-set-tags (tags)\r
+> "Set the tags of the current message."\r
+> diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+> index cd04ffd..aab6946 100644\r
+> --- a/emacs/notmuch.el\r
+> +++ b/emacs/notmuch.el\r
+> @@ -467,7 +467,7 @@ Complete list of currently available key bindings:\r
+> "Display the currently selected thread."\r
+> (interactive "P")\r
+> (let ((thread-id (notmuch-search-find-thread-id))\r
+> - (subject (notmuch-prettify-subject (notmuch-search-find-subject))))\r
+> + (subject (notmuch-pretty-non-empty-subject (notmuch-search-find-subject))))\r
+> (if (> (length thread-id) 0)\r
+> (notmuch-show thread-id\r
+> (current-buffer)\r
+> @@ -850,7 +850,7 @@ non-authors is found, assume that all of the authors match."\r
+> (insert (concat "Error: Unexpected output from notmuch search:\n" (substring string line (match-beginning 1)) "\n")))\r
+> (let ((beg (point)))\r
+> (notmuch-search-show-result date count authors\r
+> - (notmuch-prettify-subject subject) tags)\r
+> + (notmuch-pretty-subject subject) tags)\r
+> (notmuch-search-color-line beg (point) tag-list)\r
+> (put-text-property beg (point) 'notmuch-search-thread-id thread-id)\r
+> (put-text-property beg (point) 'notmuch-search-authors authors)\r
+> -- \r
+> 1.7.8.3\r
+> \r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r