unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Austin Clements <amdragon@MIT.EDU>
To: David Edmondson <dme@dme.org>
Cc: notmuch@notmuchmail.org
Subject: Re: [PATCH 3/3] emacs: Prefer '[No Subject]' to blank subjects.
Date: Sat, 28 Jan 2012 00:22:00 -0500	[thread overview]
Message-ID: <20120128052200.GB17991@mit.edu> (raw)
In-Reply-To: <1327499314-7887-4-git-send-email-dme@dme.org>

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 <dme@dme.org>
>  
> +(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

  parent reply	other threads:[~2012-01-28  5:22 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-25 13:08 [PATCH 0/3] minor cleanup and improvements David Edmondson
2012-01-25 13:08 ` [PATCH 1/3] emacs: Stop the `truncate-string-to-width' madness David Edmondson
2012-01-25 13:08 ` [PATCH 2/3] emacs: Don't mark messages as "unsaved" when printing David Edmondson
2012-01-25 13:08 ` [PATCH 3/3] emacs: Prefer '[No Subject]' to blank subjects David Edmondson
2012-01-25 13:13   ` David Edmondson
2012-01-25 13:48 ` [PATCH 0/3 v2] minor cleanup and improvements David Edmondson
2012-01-25 13:48   ` [PATCH 1/3] emacs: Stop the `truncate-string-to-width' madness David Edmondson
2012-01-28  5:09     ` Austin Clements
2012-01-30  9:16       ` David Edmondson
2012-01-25 13:48   ` [PATCH 2/3] emacs: Don't mark messages as "unsaved" when printing David Edmondson
2012-01-27 12:04     ` David Bremner
2012-01-27 12:05     ` David Bremner
2012-01-25 13:48   ` [PATCH 3/3] emacs: Prefer '[No Subject]' to blank subjects David Edmondson
     [not found]     ` <874nvh5tro.fsf@qmul.ac.uk>
2012-01-27 10:28       ` David Edmondson
2012-01-27 13:31         ` Mark Walters
2012-01-27 13:39           ` David Edmondson
2012-01-27 10:32     ` Mark Walters
2012-01-28  5:22     ` Austin Clements [this message]
2012-01-27  9:26   ` [PATCH 0/3 v2] minor cleanup and improvements David Edmondson
2012-01-30 10:15 ` [PATCH 0/2 " David Edmondson
2012-01-30 10:16   ` [PATCH 1/2 v2] emacs: Stop the `truncate-string-to-width' madness David Edmondson
2012-01-30 23:46     ` Austin Clements
2012-01-31  6:15       ` David Edmondson
2012-01-30 10:16   ` [PATCH 2/2 v2] emacs: Prefer '[No Subject]' to blank subjects David Edmondson
2012-01-30 23:48     ` Austin Clements
2012-02-06  7:07     ` Jameson Graef Rollins
2012-02-06  7:47       ` David Edmondson
2012-02-06  8:06         ` Jameson Graef Rollins
2012-02-06  8:56           ` David Edmondson
2012-02-06 19:19             ` Jameson Graef Rollins
2012-02-06 19:34               ` David Edmondson
2012-02-06 19:50       ` Antoine Beaupré
2012-02-28  1:52     ` David Bremner
2012-01-30 10:18   ` [PATCH 0/2 v2] minor cleanup and improvements David Edmondson
2012-02-04 12:39   ` David Bremner
2012-02-06 21:30 ` [PATCH] emacs: Leave blank subjects alone by default David Edmondson
2012-02-12 20:51   ` Jameson Graef Rollins
2012-02-06 22:48 ` [PATCH v2] " David Edmondson
2012-02-12  8:52   ` Mark Walters

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120128052200.GB17991@mit.edu \
    --to=amdragon@mit.edu \
    --cc=dme@dme.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).