X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch.el;h=b44a907a74c7eb7d8ea4320176417a3534d3d55f;hb=26b6470db350cc4b319934c1caff261ada12b4bb;hp=f6bf9c84d6a9cc4c86c647237d668e5a60784daf;hpb=fea7a411811a6dd3decca335ffa8daa4f805acb5;p=notmuch diff --git a/emacs/notmuch.el b/emacs/notmuch.el index f6bf9c84..b44a907a 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -580,7 +580,8 @@ This function advances the next thread when finished." (when notmuch-archive-tags (notmuch-search-tag (notmuch-tag-change-list notmuch-archive-tags unarchive) beg end)) - (notmuch-search-next-thread)) + (when (eq beg end) + (notmuch-search-next-thread))) (defun notmuch-search-update-result (result &optional pos) "Replace the result object of the thread at POS (or point) by @@ -862,6 +863,10 @@ PROMPT is the string to prompt with." (concat "tag:" (notmuch-escape-boolean-term tag))) (process-lines notmuch-command "search" "--output=tags" "*"))))) (let ((keymap (copy-keymap minibuffer-local-map)) + (current-query (case major-mode + (notmuch-search-mode (notmuch-search-get-query)) + (notmuch-show-mode (notmuch-show-get-query)) + (notmuch-tree-mode (notmuch-tree-get-query)))) (minibuffer-completion-table (completion-table-dynamic (lambda (string) @@ -879,7 +884,11 @@ PROMPT is the string to prompt with." (define-key keymap (kbd "TAB") 'minibuffer-complete) (let ((history-delete-duplicates t)) (read-from-minibuffer prompt nil keymap nil - 'notmuch-search-history nil nil))))) + 'notmuch-search-history current-query nil))))) + +(defun notmuch-search-get-query () + "Return the current query in this search buffer" + notmuch-search-query-string) ;;;###autoload (put 'notmuch-search 'notmuch-doc "Search for messages.")