[PATCH v2 4/7] emacs: make emacs tagging use the stdin query functionality
Austin Clements
amdragon at MIT.EDU
Sat Nov 24 14:09:28 PST 2012
Quoth markwalters1009 on Nov 24 at 1:20 pm:
> From: Mark Walters <markwalters1009 at gmail.com>
>
> In preparation for the use of large queries in some cases make tagging
> from emacs use the new query on stdin functionality. Currently uses
> this for all tagging (as I could not see a reason not to).
> ---
> emacs/notmuch-tag.el | 14 +++++++++-----
> 1 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
> index 4fce3a9..4634b0d 100644
> --- a/emacs/notmuch-tag.el
> +++ b/emacs/notmuch-tag.el
> @@ -59,9 +59,10 @@ the messages that were tagged"
> (setq search-terms (list "*")))
> (split-string
> (with-output-to-string
> - (with-current-buffer standard-output
> - (apply 'call-process notmuch-command nil t
> - nil "search" "--output=tags" "--exclude=false" search-terms)))
> + (with-temp-buffer
> + (insert (mapconcat 'identity search-terms " "))
#'identity ?
> + (apply 'call-process-region (point-min) (point-max) notmuch-command nil
#'call-process-region ?
> + standard-output nil "search" "--output=tags" "--exclude=false" (list "-"))))
If you use funcall instead of apply here, you won't need to put "-" in
a list.
Also, the lines seem a little long (but maybe that's just diff and
quoting?)
> "\n+" t))
>
> (defun notmuch-select-tag-with-completion (prompt &rest search-terms)
> @@ -134,8 +135,11 @@ notmuch-after-tag-hook will be run."
> tag-changes)
> (unless (null tag-changes)
> (run-hooks 'notmuch-before-tag-hook)
> - (apply 'notmuch-call-notmuch-process "tag"
> - (append tag-changes (list "--" query)))
> + (with-temp-buffer
> + (insert query)
> + (apply 'notmuch-call-notmuch-process-region
#'notmuch-call-notmuch-process-region ?
> + (point-min) (point-max)
> + "tag" (append tag-changes (list "--" "-"))))
> (run-hooks 'notmuch-after-tag-hook))
> ;; in all cases we return tag-changes as a list
> tag-changes)
More information about the notmuch
mailing list