[PATCH 2/2 v2] emacs: Prefer '[No Subject]' to blank subjects.

2012-02-27 Thread David Bremner
On Mon, 30 Jan 2012 10:16:01 +, David Edmondson  wrote:
> ---
>  emacs/notmuch-lib.el   |9 +
>  emacs/notmuch-print.el |8 ++--
>  emacs/notmuch-show.el  |5 -
>  emacs/notmuch.el   |   21 +
>  4 files changed, 28 insertions(+), 15 deletions(-)

Jameson and Antoine have asked for this patch to be reverted. As far as
I understand it the printing code actually crashes on blank subjects if
this patch is removed, so it seems to me that that (slightly) outweighs
the annoyance caused by printing [No Subject].  I don't find the
argument that different people are annoyed

I'd be willing to be convinced otherwise, but as it turns out the
question is somewhat academic; there have been enough changes that this
patch no longer reverts cleanly. So Someone (TM) will have to do some to
change the behaviour; it sounds like the sensible thing to do would be to move
notmuch-prettify-subject into notmuch-print.el and call it there.

d


Re: [PATCH 2/2 v2] emacs: Prefer '[No Subject]' to blank subjects.

2012-02-27 Thread David Bremner
On Mon, 30 Jan 2012 10:16:01 +, David Edmondson d...@dme.org wrote:
 ---
  emacs/notmuch-lib.el   |9 +
  emacs/notmuch-print.el |8 ++--
  emacs/notmuch-show.el  |5 -
  emacs/notmuch.el   |   21 +
  4 files changed, 28 insertions(+), 15 deletions(-)

Jameson and Antoine have asked for this patch to be reverted. As far as
I understand it the printing code actually crashes on blank subjects if
this patch is removed, so it seems to me that that (slightly) outweighs
the annoyance caused by printing [No Subject].  I don't find the
argument that different people are annoyed

I'd be willing to be convinced otherwise, but as it turns out the
question is somewhat academic; there have been enough changes that this
patch no longer reverts cleanly. So Someone (TM) will have to do some to
change the behaviour; it sounds like the sensible thing to do would be to move
notmuch-prettify-subject into notmuch-print.el and call it there.

d
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 2/2 v2] emacs: Prefer '[No Subject]' to blank subjects.

2012-02-06 Thread David Edmondson
On Mon, 06 Feb 2012 11:19:46 -0800, Jameson Graef Rollins  wrote:
> On Mon, 06 Feb 2012 08:56:34 +, David Edmondson  wrote:
> > With blank subjects the printing code generated an error (because
> > `rename-buffer' doesn't like an empty string as the first argument), so
> > _some_ change is required.
> 
> This sounds like something that could easily be fixed in the printing
> code, without changing the show and search behavior.

Yes.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 



[PATCH 2/2 v2] emacs: Prefer '[No Subject]' to blank subjects.

2012-02-06 Thread Antoine Beaupré
On Sun, 05 Feb 2012 23:07:02 -0800, Jameson Graef Rollins  wrote:
> Sorry to be so late on this, but I'm not a big fan of this new feature.
> I would prefer to always see the subject (or any other field for that
> matter) as is.

I agree. as a native french speaker, for example, it's annoying having
to change those settings everywhere I got...

a.
-- 
To be naive and easily deceived is impermissible, today more than
ever, when the prevailing untruths may lead to a catastrophe because
they blind people to real dangers and real possibilities.
- Erich Fromm
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 



[PATCH 2/2 v2] emacs: Prefer '[No Subject]' to blank subjects.

2012-02-06 Thread Jameson Graef Rollins
On Mon, 06 Feb 2012 08:56:34 +, David Edmondson  wrote:
> With blank subjects the printing code generated an error (because
> `rename-buffer' doesn't like an empty string as the first argument), so
> _some_ change is required.

This sounds like something that could easily be fixed in the printing
code, without changing the show and search behavior.

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 



[PATCH 2/2 v2] emacs: Prefer '[No Subject]' to blank subjects.

2012-02-06 Thread David Edmondson
On Mon, 06 Feb 2012 00:06:54 -0800, Jameson Graef Rollins  wrote:
> On Mon, 06 Feb 2012 07:47:38 +, David Edmondson  wrote:
> > On Sun, 05 Feb 2012 23:07:02 -0800, Jameson Graef Rollins  > finestructure.net> wrote:
> > > Sorry to be so late on this, but I'm not a big fan of this new feature.
> > > I would prefer to always see the subject (or any other field for that
> > > matter) as is.
> > 
> > The Emacs UI always replaced blank subjects with '[No Subject]' in
> > buffer names. The printing code also needed something other than a blank
> > subject for buffer renaming.
> 
> I don't much care what the buffer name is.  That seems to be a
> completely different issue to me.

I agree that they could be treated differently.

With blank subjects the printing code generated an error (because
`rename-buffer' doesn't like an empty string as the first argument), so
_some_ change is required.

> > Updating `notmuch-prettify-subject' to use a user configurable string
> > (that can be set to the empty string) sounds like a good idea. Please
> > ensure that the various other bits of code that require something other
> > than a blank subject still work properly.
> 
> I am actually perfectly happy to see this patch reverted.

Whatever bremner decides.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 



[PATCH 2/2 v2] emacs: Prefer '[No Subject]' to blank subjects.

2012-02-06 Thread David Edmondson
On Sun, 05 Feb 2012 23:07:02 -0800, Jameson Graef Rollins  wrote:
> Sorry to be so late on this, but I'm not a big fan of this new feature.
> I would prefer to always see the subject (or any other field for that
> matter) as is.

The Emacs UI always replaced blank subjects with '[No Subject]' in
buffer names. The printing code also needed something other than a blank
subject for buffer renaming.

> As a principle I would prefer there not be text replacements unless it's
> very clear that text has been replaced.  Buttons work because it's clear
> they're buttons.  This is not the case here, though, since this text
> replacement could actually be confused with real text.
> 
> It's also not clear to me why this feature would be needed.  I have
> never found blank subjects confusing.  The field is always clearly
> delineated, at least in search and show mode.  If it's not clear
> elsewhere, maybe we can make the delineation of the subject field
> clearer, but leave the actual subject text string alone.
> 
> If some feel this feature is really needed we should at least have a
> customization variable.  notmuch-unblank-subject?  I don't have any good
> name suggestions, though.

Updating `notmuch-prettify-subject' to use a user configurable string
(that can be set to the empty string) sounds like a good idea. Please
ensure that the various other bits of code that require something other
than a blank subject still work properly.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 



[PATCH 2/2 v2] emacs: Prefer '[No Subject]' to blank subjects.

2012-02-06 Thread Jameson Graef Rollins
On Mon, 06 Feb 2012 07:47:38 +, David Edmondson  wrote:
> On Sun, 05 Feb 2012 23:07:02 -0800, Jameson Graef Rollins  finestructure.net> wrote:
> > Sorry to be so late on this, but I'm not a big fan of this new feature.
> > I would prefer to always see the subject (or any other field for that
> > matter) as is.
> 
> The Emacs UI always replaced blank subjects with '[No Subject]' in
> buffer names. The printing code also needed something other than a blank
> subject for buffer renaming.

I don't much care what the buffer name is.  That seems to be a
completely different issue to me.

> Updating `notmuch-prettify-subject' to use a user configurable string
> (that can be set to the empty string) sounds like a good idea. Please
> ensure that the various other bits of code that require something other
> than a blank subject still work properly.

I am actually perfectly happy to see this patch reverted.

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 



Re: [PATCH 2/2 v2] emacs: Prefer '[No Subject]' to blank subjects.

2012-02-06 Thread Jameson Graef Rollins
On Mon, 06 Feb 2012 07:47:38 +, David Edmondson d...@dme.org wrote:
 On Sun, 05 Feb 2012 23:07:02 -0800, Jameson Graef Rollins 
 jroll...@finestructure.net wrote:
  Sorry to be so late on this, but I'm not a big fan of this new feature.
  I would prefer to always see the subject (or any other field for that
  matter) as is.
 
 The Emacs UI always replaced blank subjects with '[No Subject]' in
 buffer names. The printing code also needed something other than a blank
 subject for buffer renaming.

I don't much care what the buffer name is.  That seems to be a
completely different issue to me.

 Updating `notmuch-prettify-subject' to use a user configurable string
 (that can be set to the empty string) sounds like a good idea. Please
 ensure that the various other bits of code that require something other
 than a blank subject still work properly.

I am actually perfectly happy to see this patch reverted.

jamie.


pgp9yN2I2nRZ5.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/2 v2] emacs: Prefer '[No Subject]' to blank subjects.

2012-02-06 Thread David Edmondson
On Mon, 06 Feb 2012 00:06:54 -0800, Jameson Graef Rollins 
jroll...@finestructure.net wrote:
 On Mon, 06 Feb 2012 07:47:38 +, David Edmondson d...@dme.org wrote:
  On Sun, 05 Feb 2012 23:07:02 -0800, Jameson Graef Rollins 
  jroll...@finestructure.net wrote:
   Sorry to be so late on this, but I'm not a big fan of this new feature.
   I would prefer to always see the subject (or any other field for that
   matter) as is.
  
  The Emacs UI always replaced blank subjects with '[No Subject]' in
  buffer names. The printing code also needed something other than a blank
  subject for buffer renaming.
 
 I don't much care what the buffer name is.  That seems to be a
 completely different issue to me.

I agree that they could be treated differently.

With blank subjects the printing code generated an error (because
`rename-buffer' doesn't like an empty string as the first argument), so
_some_ change is required.

  Updating `notmuch-prettify-subject' to use a user configurable string
  (that can be set to the empty string) sounds like a good idea. Please
  ensure that the various other bits of code that require something other
  than a blank subject still work properly.
 
 I am actually perfectly happy to see this patch reverted.

Whatever bremner decides.


pgpiLc8V5xuoG.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/2 v2] emacs: Prefer '[No Subject]' to blank subjects.

2012-02-06 Thread Jameson Graef Rollins
On Mon, 06 Feb 2012 08:56:34 +, David Edmondson d...@dme.org wrote:
 With blank subjects the printing code generated an error (because
 `rename-buffer' doesn't like an empty string as the first argument), so
 _some_ change is required.

This sounds like something that could easily be fixed in the printing
code, without changing the show and search behavior.

jamie.


pgpImDa1Wd9Tw.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/2 v2] emacs: Prefer '[No Subject]' to blank subjects.

2012-02-06 Thread David Edmondson
On Mon, 06 Feb 2012 11:19:46 -0800, Jameson Graef Rollins 
jroll...@finestructure.net wrote:
 On Mon, 06 Feb 2012 08:56:34 +, David Edmondson d...@dme.org wrote:
  With blank subjects the printing code generated an error (because
  `rename-buffer' doesn't like an empty string as the first argument), so
  _some_ change is required.
 
 This sounds like something that could easily be fixed in the printing
 code, without changing the show and search behavior.

Yes.


pgp2eSKFceuOB.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/2 v2] emacs: Prefer '[No Subject]' to blank subjects.

2012-02-06 Thread Antoine Beaupré
On Sun, 05 Feb 2012 23:07:02 -0800, Jameson Graef Rollins 
jroll...@finestructure.net wrote:
 Sorry to be so late on this, but I'm not a big fan of this new feature.
 I would prefer to always see the subject (or any other field for that
 matter) as is.

I agree. as a native french speaker, for example, it's annoying having
to change those settings everywhere I got...

a.
-- 
To be naive and easily deceived is impermissible, today more than
ever, when the prevailing untruths may lead to a catastrophe because
they blind people to real dangers and real possibilities.
- Erich Fromm


pgpTvohZnwAwD.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 2/2 v2] emacs: Prefer '[No Subject]' to blank subjects.

2012-02-05 Thread Jameson Graef Rollins
Sorry to be so late on this, but I'm not a big fan of this new feature.
I would prefer to always see the subject (or any other field for that
matter) as is.

As a principle I would prefer there not be text replacements unless it's
very clear that text has been replaced.  Buttons work because it's clear
they're buttons.  This is not the case here, though, since this text
replacement could actually be confused with real text.

It's also not clear to me why this feature would be needed.  I have
never found blank subjects confusing.  The field is always clearly
delineated, at least in search and show mode.  If it's not clear
elsewhere, maybe we can make the delineation of the subject field
clearer, but leave the actual subject text string alone.

If some feel this feature is really needed we should at least have a
customization variable.  notmuch-unblank-subject?  I don't have any good
name suggestions, though.

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 



Re: [PATCH 2/2 v2] emacs: Prefer '[No Subject]' to blank subjects.

2012-02-05 Thread Jameson Graef Rollins
Sorry to be so late on this, but I'm not a big fan of this new feature.
I would prefer to always see the subject (or any other field for that
matter) as is.

As a principle I would prefer there not be text replacements unless it's
very clear that text has been replaced.  Buttons work because it's clear
they're buttons.  This is not the case here, though, since this text
replacement could actually be confused with real text.

It's also not clear to me why this feature would be needed.  I have
never found blank subjects confusing.  The field is always clearly
delineated, at least in search and show mode.  If it's not clear
elsewhere, maybe we can make the delineation of the subject field
clearer, but leave the actual subject text string alone.

If some feel this feature is really needed we should at least have a
customization variable.  notmuch-unblank-subject?  I don't have any good
name suggestions, though.

jamie.


pgpcNQLF5m847.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/2 v2] emacs: Prefer '[No Subject]' to blank subjects.

2012-02-05 Thread David Edmondson
On Sun, 05 Feb 2012 23:07:02 -0800, Jameson Graef Rollins 
jroll...@finestructure.net wrote:
 Sorry to be so late on this, but I'm not a big fan of this new feature.
 I would prefer to always see the subject (or any other field for that
 matter) as is.

The Emacs UI always replaced blank subjects with '[No Subject]' in
buffer names. The printing code also needed something other than a blank
subject for buffer renaming.

 As a principle I would prefer there not be text replacements unless it's
 very clear that text has been replaced.  Buttons work because it's clear
 they're buttons.  This is not the case here, though, since this text
 replacement could actually be confused with real text.
 
 It's also not clear to me why this feature would be needed.  I have
 never found blank subjects confusing.  The field is always clearly
 delineated, at least in search and show mode.  If it's not clear
 elsewhere, maybe we can make the delineation of the subject field
 clearer, but leave the actual subject text string alone.
 
 If some feel this feature is really needed we should at least have a
 customization variable.  notmuch-unblank-subject?  I don't have any good
 name suggestions, though.

Updating `notmuch-prettify-subject' to use a user configurable string
(that can be set to the empty string) sounds like a good idea. Please
ensure that the various other bits of code that require something other
than a blank subject still work properly.


pgpYDcDx8nHlr.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 2/2 v2] emacs: Prefer '[No Subject]' to blank subjects.

2012-01-30 Thread Austin Clements
LGTM.

Quoth David Edmondson on Jan 30 at 10:16 am:
> ---
>  emacs/notmuch-lib.el   |9 +
>  emacs/notmuch-print.el |8 ++--
>  emacs/notmuch-show.el  |5 -
>  emacs/notmuch.el   |   21 +
>  4 files changed, 28 insertions(+), 15 deletions(-)
> 
> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> index c906ca7..d315f76 100644
> --- a/emacs/notmuch-lib.el
> +++ b/emacs/notmuch-lib.el
> @@ -133,6 +133,15 @@ the user hasn't set this variable with the old or new 
> value."
>(interactive)
>(kill-buffer (current-buffer)))
>  
> +(defun notmuch-prettify-subject (subject)
> +  ;; This function is used by `notmuch-search-process-filter' which
> +  ;; requires that we not disrupt its' matching state.
> +  (save-match-data
> +(if (and subject
> +  (string-match "^[ \t]*$" subject))
> + "[No Subject]"
> +  subject)))
> +
>  ;;
>  
>  (defun notmuch-common-do-stash (text)
> diff --git a/emacs/notmuch-print.el b/emacs/notmuch-print.el
> index 880f96d..6653d97 100644
> --- a/emacs/notmuch-print.el
> +++ b/emacs/notmuch-print.el
> @@ -19,6 +19,8 @@
>  ;;
>  ;; Authors: David Edmondson 
>  
> +(require 'notmuch-lib)
> +
>  (declare-function notmuch-show-get-prop "notmuch-show" (prop  
> props))
>  
>  (defcustom notmuch-print-mechanism 'notmuch-print-lpr
> @@ -58,14 +60,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 84ac624..7ea9ba2 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1017,7 +1017,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)))
>  
> @@ -1248,6 +1248,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 d4d6904..2b0a752 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -467,18 +467,14 @@ 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)))
> + (subject (notmuch-prettify-subject (notmuch-search-find-subject
>  (if (> (length thread-id) 0)
> - (progn
> -   (if (string-match "^[ \t]*$" subject)
> -   (setq subject "[No Subject]"))
> -
> -   (notmuch-show thread-id
> - (current-buffer)
> - notmuch-search-query-string
> - ;; Name the buffer based on the subject.
> - (concat "*" (truncate-string-to-width subject 30 nil 
> nil t) "*")
> - crypto-switch))
> + (notmuch-show thread-id
> +   (current-buffer)
> +   notmuch-search-query-string
> +   ;; Name the buffer based on the subject.
> +   (concat "*" (truncate-string-to-width subject 30 nil nil 
> t) "*")
> +   crypto-switch)
>(message "End of search results."
>  
>  (defun notmuch-search-reply-to-thread ( prompt-for-sender)
> @@ -854,7 +850,8 @@ non-authors is found, assume that all of the authors 
> match."
> (if (/= (match-beginning 1) line)
> (insert (concat "Error: Unexpected output from 
> notmuch search:\n" (substring string line (match-beginning 1)) "\n")))
> (let ((beg (point)))
> - (notmuch-search-show-result date count authors subject 
> tags)
> + (notmuch-search-show-result date count authors
> +

[PATCH 2/2 v2] emacs: Prefer '[No Subject]' to blank subjects.

2012-01-30 Thread David Edmondson
---
 emacs/notmuch-lib.el   |9 +
 emacs/notmuch-print.el |8 ++--
 emacs/notmuch-show.el  |5 -
 emacs/notmuch.el   |   21 +
 4 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index c906ca7..d315f76 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -133,6 +133,15 @@ the user hasn't set this variable with the old or new 
value."
   (interactive)
   (kill-buffer (current-buffer)))

+(defun notmuch-prettify-subject (subject)
+  ;; This function is used by `notmuch-search-process-filter' which
+  ;; requires that we not disrupt its' matching state.
+  (save-match-data
+(if (and subject
+(string-match "^[ \t]*$" subject))
+   "[No Subject]"
+  subject)))
+
 ;;

 (defun notmuch-common-do-stash (text)
diff --git a/emacs/notmuch-print.el b/emacs/notmuch-print.el
index 880f96d..6653d97 100644
--- a/emacs/notmuch-print.el
+++ b/emacs/notmuch-print.el
@@ -19,6 +19,8 @@
 ;;
 ;; Authors: David Edmondson 

+(require 'notmuch-lib)
+
 (declare-function notmuch-show-get-prop "notmuch-show" (prop  props))

 (defcustom notmuch-print-mechanism 'notmuch-print-lpr
@@ -58,14 +60,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 84ac624..7ea9ba2 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1017,7 +1017,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)))

@@ -1248,6 +1248,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 d4d6904..2b0a752 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -467,18 +467,14 @@ 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)))
+   (subject (notmuch-prettify-subject (notmuch-search-find-subject
 (if (> (length thread-id) 0)
-   (progn
- (if (string-match "^[ \t]*$" subject)
- (setq subject "[No Subject]"))
-
- (notmuch-show thread-id
-   (current-buffer)
-   notmuch-search-query-string
-   ;; Name the buffer based on the subject.
-   (concat "*" (truncate-string-to-width subject 30 nil 
nil t) "*")
-   crypto-switch))
+   (notmuch-show thread-id
+ (current-buffer)
+ notmuch-search-query-string
+ ;; Name the buffer based on the subject.
+ (concat "*" (truncate-string-to-width subject 30 nil nil 
t) "*")
+ crypto-switch)
   (message "End of search results."

 (defun notmuch-search-reply-to-thread ( prompt-for-sender)
@@ -854,7 +850,8 @@ non-authors is found, assume that all of the authors match."
  (if (/= (match-beginning 1) line)
  (insert (concat "Error: Unexpected output from 
notmuch search:\n" (substring string line (match-beginning 1)) "\n")))
  (let ((beg (point)))
-   (notmuch-search-show-result date count authors subject 
tags)
+   (notmuch-search-show-result date count authors
+   (notmuch-prettify-subject 
subject) tags)
(notmuch-search-color-line beg (point) tag-list)
(put-text-property beg (point) 
'notmuch-search-thread-id thread-id)