X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch.el;h=85a54706c4df0c4e14ca44af950e4fcf89da1707;hb=63b4c469835133ac44b7db516fc54b8a4abb90a8;hp=479b39f1fb81bd0c8a9d1b8f84c580cfa14cce58;hpb=7556bb7da27621895327b84d22abba2519c24ba7;p=notmuch diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 479b39f1..85a54706 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -535,12 +535,12 @@ thread." (message "End of search results.")))) (defun notmuch-tree-from-search-current-query () - "Call notmuch tree with the current query." + "Tree view of current query." (interactive) (notmuch-tree notmuch-search-query-string)) (defun notmuch-unthreaded-from-search-current-query () - "Call notmuch tree with the current query." + "Unthreaded view of current query." (interactive) (notmuch-unthreaded notmuch-search-query-string)) @@ -880,6 +880,14 @@ sets the :orig-tag property." (setq notmuch-search-target-thread "found") (goto-char pos)))) +(defvar-local notmuch--search-hook-run nil + "Flag used to ensure the notmuch-search-hook is only run once per buffer") + +(defun notmuch--search-hook-wrapper () + (unless notmuch--search-hook-run + (setq notmuch--search-hook-run t) + (run-hooks 'notmuch-search-hook))) + (defun notmuch-search-process-filter (proc string) "Process and filter the output of \"notmuch search\"." (let ((results-buf (process-buffer proc)) @@ -892,7 +900,9 @@ sets the :orig-tag property." (goto-char (point-max)) (insert string)) (notmuch-sexp-parse-partial-list 'notmuch-search-append-result - results-buf))))) + results-buf)) + (with-current-buffer results-buf + (notmuch--search-hook-wrapper))))) ;;; Commands (and some helper functions used by them) @@ -940,7 +950,7 @@ See `notmuch-tag' for information on the format of TAG-CHANGES." PROMPT is the string to prompt with." (let* ((all-tags (mapcar (lambda (tag) (notmuch-escape-boolean-term tag)) - (process-lines notmuch-command "search" "--output=tags" "*"))) + (notmuch--process-lines notmuch-command "search" "--output=tags" "*"))) (completions (append (list "folder:" "path:" "thread:" "id:" "date:" "from:" "to:" "subject:" "attachment:") @@ -1036,8 +1046,7 @@ the configured default sort order." (process-put proc 'parse-buf (generate-new-buffer " *notmuch search parse*")) (set-process-filter proc 'notmuch-search-process-filter) - (set-process-query-on-exit-flag proc nil)))) - (run-hooks 'notmuch-search-hook))) + (set-process-query-on-exit-flag proc nil)))))) (defun notmuch-search-refresh-view () "Refresh the current view.