From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 454DA431FB6 for ; Fri, 27 Jan 2012 21:22:46 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FA+IpXQlePGr for ; Fri, 27 Jan 2012 21:22:45 -0800 (PST) Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU [18.9.25.15]) by olra.theworths.org (Postfix) with ESMTP id 858C6431FAE for ; Fri, 27 Jan 2012 21:22:45 -0800 (PST) X-AuditID: 1209190f-b7f8a6d000000914-d9-4f23862416c7 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP id 94.F5.02324.426832F4; Sat, 28 Jan 2012 00:22:44 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id q0S5Mijv030362; Sat, 28 Jan 2012 00:22:44 -0500 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q0S5MhYB009718 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Sat, 28 Jan 2012 00:22:44 -0500 (EST) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) (envelope-from ) id 1Rr0jg-00050q-W1; Sat, 28 Jan 2012 00:22:01 -0500 Date: Sat, 28 Jan 2012 00:22:00 -0500 From: Austin Clements To: David Edmondson Subject: Re: [PATCH 3/3] emacs: Prefer '[No Subject]' to blank subjects. Message-ID: <20120128052200.GB17991@mit.edu> References: <1327496913-4946-1-git-send-email-dme@dme.org> <1327499314-7887-1-git-send-email-dme@dme.org> <1327499314-7887-4-git-send-email-dme@dme.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1327499314-7887-4-git-send-email-dme@dme.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpmleLIzCtJLcpLzFFi42IR4hTV1lVpU/Y3WLDc0GLfnS1MFtdvzmR2 YPLY9fwvk8ezVbeYA5iiuGxSUnMyy1KL9O0SuDL+v5vHXNAsWzFzDmcD4wbxLkZODgkBE4kz J74zQthiEhfurWfrYuTiEBLYxyixeNMnJghnA6PEsSXbmCGck0wSb+5PZIFwljBKdN06yATS zyKgKnH5VRfYLDYBDYlt+5eD2SICihL/v61gB7GZBaQlvv1uBqsXFvCQaL63FMzmFdCRWL/5 EtSGOYwSq3qfsEMkBCVOznzCAtGsJXHj30ugBg6wQcv/cYCYnALWEmu/soFUiAqoSEw5uY1t AqPQLCTNs5A0z0JoXsDIvIpRNiW3Sjc3MTOnODVZtzg5MS8vtUjXRC83s0QvNaV0EyM4rCX5 dzB+O6h0iFGAg1GJh/fCKyV/IdbEsuLK3EOMkhxMSqK8sq3K/kJ8SfkplRmJxRnxRaU5qcWH GCU4mJVEeO94KfoL8aYkVlalFuXDpKQ5WJTEedW03vkJCaQnlqRmp6YWpBbBZGU4OJQkeJeA DBUsSk1PrUjLzClBSDNxcIIM5wEangNSw1tckJhbnJkOkT/FqCglztsLkhAASWSU5sH1wtLO K0ZxoFeEeTeBVPEAUxZc9yugwUxAgyOuglxdXJKIkJJqYJx65p5g6qJF2Z9mhdZ6bYj7z6Ep k2n5WudXFo/1TJv7ZRHS1n8jW25Mz87MYxORT6+3vu7029vT9Mzd/fnLeQ6/u3WchaGW8Zb4 VFG+C6bry1KstAomv/1hVrJRYofU6og9+yVr5rlPeqvsF5O9x0msUJhF2m5HsLVimaTmpFXf vv9nOlHBo8RSnJFoqMVcVJwIANLUFp8WAwAA Cc: notmuch@notmuchmail.org X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jan 2012 05:22:46 -0000 LGTM other than what Mark pointed out about this not applying to subjects in the search buffer. Quoth David Edmondson on Jan 25 at 1:48 pm: > --- > emacs/notmuch-lib.el | 6 ++++++ > emacs/notmuch-print.el | 8 ++++++-- > emacs/notmuch-show.el | 5 ++++- > emacs/notmuch.el | 5 +---- > 4 files changed, 17 insertions(+), 7 deletions(-) > > diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el > index 241fe8c..5b8a41c 100644 > --- a/emacs/notmuch-lib.el > +++ b/emacs/notmuch-lib.el > @@ -130,6 +130,12 @@ the user hasn't set this variable with the old or new value." > (interactive) > (kill-buffer (current-buffer))) > > +(defun notmuch-prettify-subject (subject) > + (if (and subject > + (string-match "^[ \t]*$" subject)) > + (setq subject "[No Subject]")) > + subject) > + > ;; > > (defun notmuch-common-do-stash (text) > diff --git a/emacs/notmuch-print.el b/emacs/notmuch-print.el > index 83eb525..51bb740 100644 > --- a/emacs/notmuch-print.el > +++ b/emacs/notmuch-print.el > @@ -19,6 +19,8 @@ > ;; > ;; Authors: David Edmondson > > +(require 'notmuch-lib) > + > (defcustom notmuch-print-mechanism 'notmuch-print-lpr > "How should printing be done?" > :group 'notmuch > @@ -56,14 +58,16 @@ Optional OUTPUT allows passing a list of flags to muttprint." > > (defun notmuch-print-ps-print (msg) > "Print a message buffer using the ps-print package." > - (let ((subject (plist-get (notmuch-show-get-prop :headers msg) :Subject))) > + (let ((subject (notmuch-prettify-subject > + (plist-get (notmuch-show-get-prop :headers msg) :Subject)))) > (rename-buffer subject t) > (ps-print-buffer))) > > (defun notmuch-print-ps-print/evince (msg) > "Preview a message buffer using ps-print and evince." > (let ((ps-file (make-temp-file "notmuch")) > - (subject (plist-get (notmuch-show-get-prop :headers msg) :Subject))) > + (subject (notmuch-prettify-subject > + (plist-get (notmuch-show-get-prop :headers msg) :Subject)))) > (rename-buffer subject t) > (ps-print-buffer ps-file) > (notmuch-print-run-evince ps-file))) > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el > index e6a5b31..c602b3e 100644 > --- a/emacs/notmuch-show.el > +++ b/emacs/notmuch-show.el > @@ -985,7 +985,7 @@ buffer." > (notmuch-show-next-open-message)) > > ;; Set the header line to the subject of the first open message. > - (setq header-line-format (notmuch-show-strip-re (notmuch-show-get-subject))) > + (setq header-line-format (notmuch-show-strip-re (notmuch-show-get-pretty-subject))) > > (notmuch-show-mark-read))) > > @@ -1216,6 +1216,9 @@ Some useful entries are: > (defun notmuch-show-get-depth () > (notmuch-show-get-prop :depth)) > > +(defun notmuch-show-get-pretty-subject () > + (notmuch-prettify-subject (notmuch-show-get-subject))) > + > (defun notmuch-show-set-tags (tags) > "Set the tags of the current message." > (notmuch-show-set-prop :tags tags) > diff --git a/emacs/notmuch.el b/emacs/notmuch.el > index 3f6b977..ce1e232 100644 > --- a/emacs/notmuch.el > +++ b/emacs/notmuch.el > @@ -440,10 +440,7 @@ Complete list of currently available key bindings: > "Display the currently selected thread." > (interactive "P") > (let ((thread-id (notmuch-search-find-thread-id)) > - (subject (notmuch-search-find-subject))) > - > - (if (string-match "^[ \t]*$" subject) > - (setq subject "[No Subject]")) > + (subject (notmuch-prettify-subject (notmuch-search-find-subject)))) > > (if (> (length thread-id) 0) > (notmuch-show thread-id