[PATCH 1/4] emacs: new customization variable to exclude "deleted" messages from search

Aaron Ecay aaronecay at gmail.com
Sun Jan 8 17:14:49 PST 2012


Jameson,

One comment

On Sat,  7 Jan 2012 14:28:11 -0800, Jameson Graef Rollins <jrollins at finestructure.net> wrote:
> The new customization variable, notmuch-search-exclude-deleted, when
> set to t, will exclude any messages with the "deleted" tag from
> searches.
> 
> Additionally, specifying "tag:deleted" in the search directly will
> override the exclusion and will included deleted messages in the
> search results.
> ---
>  emacs/notmuch.el                                   |    8 ++++
>  test/emacs                                         |   42 ++++++++++++++++++++
>  .../notmuch-search-tag-inbox-deleted-excluded      |   24 +++++++++++
>  3 files changed, 74 insertions(+), 0 deletions(-)
>  create mode 100644 test/emacs.expected-output/notmuch-search-tag-inbox-deleted-excluded
> 
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index fde2377..c519687 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -905,6 +905,11 @@ PROMPT is the string to prompt with."
>        (read-from-minibuffer prompt nil keymap nil
>  			    'notmuch-query-history nil nil))))
>  
> +(defcustom notmuch-search-exclude-deleted nil
> +  "Exclude deleted messages (with \"deleted\" tag) from search results."
> +  :group 'notmuch
> +  :type 'boolean)
> +
>  ;;;###autoload
>  (defun notmuch-search (query &optional oldest-first target-thread target-line continuation)
>    "Run \"notmuch search\" with the given query string and display results.
> @@ -927,6 +932,9 @@ The optional parameters are used as follows:
>      (set 'notmuch-search-target-thread target-thread)
>      (set 'notmuch-search-target-line target-line)
>      (set 'notmuch-search-continuation continuation)
> +    (when (and notmuch-search-exclude-deleted
> +	       (not (string-match "tag:deleted[ )]*" query)))

“is:” is a synonym for “tag:” in searches – so this section of the code
should look for it too.

-- 
Aaron Ecay


More information about the notmuch mailing list