unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Austin Clements <amdragon@MIT.EDU>
To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org
Subject: Re: [PATCH 6/7] emacs: search: use orig-tags in search
Date: Tue, 11 Feb 2014 20:30:48 -0500	[thread overview]
Message-ID: <87lhxhm81j.fsf@awakening.csail.mit.edu> (raw)
In-Reply-To: <1390087855-26194-7-git-send-email-markwalters1009@gmail.com>

On Sat, 18 Jan 2014, Mark Walters <markwalters1009@gmail.com> wrote:
> This uses the recent functionality to show the tag changes in the
> search buffer. Currently this is only used to show changes the search
> buffer makes itself: i.e., it does not make display any changes
> reflecting tagging done by other notmuch-buffers.
> ---
>  emacs/notmuch.el |   12 +++++++++---
>  1 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index 1436e5a..f0ea5d4 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -753,14 +753,20 @@ non-authors is found, assume that all of the authors match."
>       format-string (notmuch-sanitize (plist-get result :authors))))
>  
>     ((string-equal field "tags")
> -    (let ((tags (plist-get result :tags)))
> -      (insert (format format-string (notmuch-tag-format-tags tags tags)))))))
> +    (let ((tags (plist-get result :tags))
> +	  (orig-tags (plist-get result :orig-tags)))
> +      (insert (format format-string (notmuch-tag-format-tags tags orig-tags)))))))
>  
>  (defun notmuch-search-show-result (result &optional pos)
>    "Insert RESULT at POS or the end of the buffer if POS is null."
>    ;; Ignore excluded matches
>    (unless (= (plist-get result :matched) 0)
> -    (let ((beg (or pos (point-max))))
> +    (let ((beg (or pos (point-max)))
> +	  ;; If we are inserting the result for the first time POS
> +	  ;; will be nil and we should set orig-tags.
> +	  (result (if pos
> +		      result
> +		    (plist-put result :orig-tags (plist-get result :tags)))))

This seems rather obtuse.  I'd prefer a little wrapper that sits between
`notmuch-sexp-parse-partial-list' and `notmuch-search-show-result' that
adds :orig-tags.  The wrapper could also pass (point-max) for pos and
pos could be made a required argument.  E.g.,

(defun notmuch-search-process-result (result)
  ;; Record original tags of this message
  (setq result (plist-put result :orig-tags (plist-get result :tags)))
  ;; Append the result to the search buffer
  (notmuch-search-show-result result (point-max)))

>        (save-excursion
>  	(goto-char beg)
>  	(dolist (spec notmuch-search-result-format)
> -- 
> 1.7.9.1
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

  reply	other threads:[~2014-02-12  1:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-18 23:30 [PATCH 0/7] emacs: show tag changes in buffer Mark Walters
2014-01-18 23:30 ` [PATCH 1/7] emacs: tag split customise option for format-tags into a widget Mark Walters
2014-01-18 23:30 ` [PATCH 2/7] emacs: tag: allow default case in notmuch-tag-formats Mark Walters
2014-02-10 18:19   ` Austin Clements
2014-02-11 10:23     ` Mark Walters
2014-02-11 22:57       ` Austin Clements
2014-02-12 17:32         ` [WIP PATCH] Make keys of notmuch-tag-formats regexps and use caching Austin Clements
2014-01-18 23:30 ` [PATCH 3/7] emacs: tag: add customize for deleted/added tag formats Mark Walters
2014-01-18 23:30 ` [PATCH 4/7] emacs: show: mark tags changed since buffer loaded Mark Walters
2014-02-12  1:21   ` Austin Clements
2014-01-18 23:30 ` [PATCH 5/7] emacs: show: use orig-tags for tag display Mark Walters
2014-01-18 23:30 ` [PATCH 6/7] emacs: search: use orig-tags in search Mark Walters
2014-02-12  1:30   ` Austin Clements [this message]
2014-01-18 23:30 ` [PATCH 7/7] emacs: tree: " Mark Walters
2014-01-25 19:35 ` [PATCH 0/7] emacs: show tag changes in buffer Jani Nikula
2014-02-05 22:25 ` Tomi Ollila

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=87lhxhm81j.fsf@awakening.csail.mit.edu \
    --to=amdragon@mit.edu \
    --cc=markwalters1009@gmail.com \
    --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).