unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH v2 0/7] Improve Emacs CLI error handling
@ 2012-12-15 20:04 Austin Clements
  2012-12-15 20:04 ` [PATCH v2 1/7] emacs: Centralize notmuch command " Austin Clements
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: Austin Clements @ 2012-12-15 20:04 UTC (permalink / raw)
  To: notmuch; +Cc: tomi.ollila

This obsoletes id:1355548513-10085-1-git-send-email-amdragon@mit.edu
and fixes the things Mark and Tomi commented on.  The interdiff is
below.

diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index cf61635..8f84087 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -326,10 +326,12 @@ the user dismisses it."
     (with-current-buffer buf
       (view-mode-enter nil #'kill-buffer)
       (let ((inhibit-read-only t))
+	(goto-char (point-max))
+	(unless (bobp)
+	  (insert "\n"))
 	(insert msg)
 	(unless (bolp)
-	  (insert "\n"))
-	(goto-char (point-min))))
+	  (insert "\n"))))
     (pop-to-buffer buf)))
 
 (defun notmuch-check-async-exit-status (proc msg)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index c20de13..b0fd387 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -536,8 +536,9 @@ 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*\"."
+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)
@@ -649,7 +650,7 @@ of the result."
 		      (insert "Incomplete search results (search process was killed).\n"))
 		  (when (eq status 'exit)
 		    (insert "End of search results.\n")
-		    (condition-case err
+		    (condition-case nil
 			(notmuch-check-async-exit-status proc msg)
 		      ;; Suppress the error signal since strange
 		      ;; things happen if a sentinel signals.
diff --git a/test/emacs b/test/emacs
index 88b062c..5067d67 100755
--- a/test/emacs
+++ b/test/emacs
@@ -873,7 +873,7 @@ This is output
 Error: Unexpected output from notmuch search:
 This is an error
 End of search results.
-Error invoking notmuch.  /tmp/nmtest/tmp.emacs/notmuch_fail search --format=json --sort=newest-first tag:inbox exited with status 1."
+Error invoking notmuch.  $PWD/notmuch_fail search --format=json --sort=newest-first tag:inbox exited with status 1."
 
 
 test_done
diff --git a/test/emacs-show b/test/emacs-show
index c67c6a4..40fab61 100755
--- a/test/emacs-show
+++ b/test/emacs-show
@@ -178,7 +178,7 @@ test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\"))
 	       (with-current-buffer \"*Notmuch errors*\"
 		  (test-output \"ERROR\")))"
 test_expect_equal "$(cat OUTPUT ERROR)" "\
-Error invoking notmuch.  /tmp/nmtest/tmp.emacs-show/notmuch_fail show --format=json --exclude=false ' * ' exited with status 1.
+Error invoking notmuch.  $PWD/notmuch_fail show --format=json --exclude=false ' * ' exited with status 1.
 Error:
 This is an error
 Output:

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-12-16 21:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-15 20:04 [PATCH v2 0/7] Improve Emacs CLI error handling Austin Clements
2012-12-15 20:04 ` [PATCH v2 1/7] emacs: Centralize notmuch command " Austin Clements
2012-12-16 21:39   ` David Bremner
2012-12-15 20:04 ` [PATCH v2 2/7] emacs: Use unified error handling in notmuch-call-notmuch-process Austin Clements
2012-12-15 20:04 ` [PATCH v2 3/7] emacs: Factor out synchronous notmuch JSON invocations Austin Clements
2012-12-15 20:04 ` [PATCH v2 4/7] emacs: Improve error handling for notmuch-call-notmuch-json Austin Clements
2012-12-15 20:04 ` [PATCH v2 5/7] test: Test show's handling of subprocess errors Austin Clements
2012-12-15 20:04 ` [PATCH v2 6/7] emacs: Use unified error handling in search Austin Clements
2012-12-15 20:04 ` [PATCH v2 7/7] test: Test search's handling of subprocess errors Austin Clements
2012-12-16  1:19 ` [PATCH v2 0/7] Improve Emacs CLI error handling Mark Walters
2012-12-16  3:08 ` Tomi Ollila

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).