aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs/notmuch.el
diff options
context:
space:
mode:
authorGravatar Austin Clements <amdragon@MIT.EDU>2012-12-15 15:04:15 -0500
committerGravatar David Bremner <bremner@debian.org>2012-12-16 17:00:00 -0400
commit0844af35eb9a4843fbf7053ca37f9f69bbafdcb1 (patch)
tree2b38d6a7d3cc55c3bed565bab1f82c95e6578bf7 /emacs/notmuch.el
parent693cf03cee4ce4a805905ee8ef5faaae7f9af10b (diff)
emacs: Use unified error handling in notmuch-call-notmuch-process
This makes notmuch-call-notmuch-process use the unified CLI error handling, which basically refines the error handling this function already did.
Diffstat (limited to 'emacs/notmuch.el')
-rw-r--r--emacs/notmuch.el20
1 files changed, 7 insertions, 13 deletions
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index f9454d8b..9da8df4d 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -536,19 +536,13 @@ If BARE is set then do not prefix with \"thread:\""
(defun notmuch-call-notmuch-process (&rest args)
"Synchronously invoke \"notmuch\" with the given list of arguments.
-Output from the process will be presented to the user as an error
-and will also appear in a buffer named \"*Notmuch errors*\"."
- (let ((error-buffer (get-buffer-create "*Notmuch errors*")))
- (with-current-buffer error-buffer
- (erase-buffer))
- (if (eq (apply 'call-process notmuch-command nil error-buffer nil args) 0)
- (point)
- (progn
- (with-current-buffer error-buffer
- (let ((beg (point-min))
- (end (- (point-max) 1)))
- (error (buffer-substring beg end))
- ))))))
+If notmuch exits with a non-zero status, output from the process
+will appear in a buffer named \"*Notmuch errors*\" and an error
+will be signaled."
+ (with-temp-buffer
+ (let ((status (apply #'call-process notmuch-command nil t nil args)))
+ (notmuch-check-exit-status status (cons notmuch-command args)
+ (buffer-string)))))
(defun notmuch-search-set-tags (tags &optional pos)
(let ((new-result (plist-put (notmuch-search-get-result pos) :tags tags)))