emacs: Refuse requests to refresh tree views while a refresh is running
authorVladimir Panteleev <git@thecybershadow.net>
Mon, 14 Aug 2017 07:08:36 +0000 (07:08 +0000)
committerDavid Bremner <david@tethera.net>
Wed, 6 Sep 2017 00:50:03 +0000 (21:50 -0300)
notmuch-tree did not protect against concurrent refreshes like
notmuch-search, meaning, hitting '=' (notmuch-refresh-this-buffer)
quickly will spawn multiple parallel notmuch processes, and clobber
the existing results in the current buffer.

* notmuch-tree.el: Add a guard to notmuch-tree-refresh-view similar to
  the one in notmuch-search.

emacs/notmuch-tree.el

index 220395e712bdf0bcdce56d38f78e91ece88f0970..c00315e8dd40edaadfc369a95b2545fce49affbf 100644 (file)
@@ -598,6 +598,8 @@ message will be \"unarchived\", i.e. the tag changes in
 (defun notmuch-tree-refresh-view ()
   "Refresh view."
   (interactive)
+  (when (get-buffer-process (current-buffer))
+    (error "notmuch tree process already running for current buffer"))
   (let ((inhibit-read-only t)
        (basic-query notmuch-tree-basic-query)
        (query-context notmuch-tree-query-context)