From 94c64f62982dc2d6cb101b6e5cd9374776ba87c9 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Sun, 16 Dec 2012 01:19:50 +0000 Subject: [PATCH] Re: [PATCH v2 0/7] Improve Emacs CLI error handling --- 45/e2d6c1421197a5c2dc86f75c63b7b208f7a49b | 158 ++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 45/e2d6c1421197a5c2dc86f75c63b7b208f7a49b diff --git a/45/e2d6c1421197a5c2dc86f75c63b7b208f7a49b b/45/e2d6c1421197a5c2dc86f75c63b7b208f7a49b new file mode 100644 index 000000000..173c1f7e6 --- /dev/null +++ b/45/e2d6c1421197a5c2dc86f75c63b7b208f7a49b @@ -0,0 +1,158 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 78AEF431FBC + for ; Sat, 15 Dec 2012 17:19:55 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -1.098 +X-Spam-Level: +X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id gt005r9TChXL for ; + Sat, 15 Dec 2012 17:19:53 -0800 (PST) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 0A09F431FB6 + for ; Sat, 15 Dec 2012 17:19:53 -0800 (PST) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1Tk2tQ-0003E5-3p; Sun, 16 Dec 2012 01:19:48 +0000 +Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) + (envelope-from ) + id 1Tk2tP-0006rb-JI; Sun, 16 Dec 2012 01:19:47 +0000 +From: Mark Walters +To: Austin Clements , notmuch@notmuchmail.org +Subject: Re: [PATCH v2 0/7] Improve Emacs CLI error handling +In-Reply-To: <1355601860-30121-1-git-send-email-amdragon@mit.edu> +References: <1355601860-30121-1-git-send-email-amdragon@mit.edu> +User-Agent: Notmuch/0.14+155~g7edfdc3 (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Sun, 16 Dec 2012 01:19:50 +0000 +Message-ID: <87hanm94jt.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 93.97.24.31 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: 424a4330282f5e0d39bee46c484f1f20 (of first 20000 bytes) +X-SpamAssassin-Score: -1.8 +X-SpamAssassin-SpamBar: - +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored -1.8 points. + Summary of the scoring: + * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, + * medium trust + * [138.37.6.40 listed in list.dnswl.org] + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * 0.5 AWL AWL: From: address is in the auto white-list +X-QM-Scan-Virus: ClamAV says the message is clean +Cc: tomi.ollila@iki.fi +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sun, 16 Dec 2012 01:19:55 -0000 + + +This series looks good to me. Just one possible thought: would it be +worth time-stamping the errors (mostly in case the user does not quit +the error buffer). But +1 anyway + +Best wishes + +Mark + + +On Sat, 15 Dec 2012, Austin Clements wrote: +> 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: -- 2.26.2