From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 1CD566DE0C3F for ; Mon, 30 Oct 2017 06:32:36 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.439 X-Spam-Level: X-Spam-Status: No, score=0.439 tagged_above=-999 required=5 tests=[AWL=-0.194, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_NEUTRAL=0.652, UNPARSEABLE_RELAY=0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id htLBI4ZXCYDP for ; Mon, 30 Oct 2017 06:32:35 -0700 (PDT) Received: from mail-wm0-f47.google.com (mail-wm0-f47.google.com [74.125.82.47]) by arlo.cworth.org (Postfix) with ESMTPS id D8AB46DE0BF6 for ; Mon, 30 Oct 2017 06:32:34 -0700 (PDT) Received: by mail-wm0-f47.google.com with SMTP id r196so16499203wmf.2 for ; Mon, 30 Oct 2017 06:32:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dme-org.20150623.gappssmtp.com; s=20150623; h=to:cc:subject:in-reply-to:references:from:date:message-id :mime-version; bh=IgsJG5WKOQ9Hf5IbHzf4oEJ4XAYe1W3Ac6JIZtKtgeI=; b=GgOqiZK5mChUo7REDkhDpDJzlfAwNJG9wez8at5CEE0SfmzkyeO/b4I51sMEg1+z8M iO9htE3PIlcBn9N2MJZKW6CDP7MG8NDIlDdT28g1exxjfuty+wmjXoQWWPWeout3CDlS xdT4mADm4h0qA8uhkbd0DzzU1k0sky8uUX+r6xElZzzebb56nfmSg+i3lZZaP0lyQ8Ol VwirVJJioWK8TCy7CCZyQvxF3W4z8dUcDpwd8edheBYIlE06aoOFpXmSYVpV7z3uZZYJ 9+RmvGZiyjqfYvNwFt67qa8oNuxMMRGqu9iQuiapGdsTrOCX0qGjJH++z9bQWVbIGV02 F1fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:subject:in-reply-to:references:from:date :message-id:mime-version; bh=IgsJG5WKOQ9Hf5IbHzf4oEJ4XAYe1W3Ac6JIZtKtgeI=; b=oYTG0fju7L4SU2ml4FFePQRLbNyzJ5fhxB1EUIcEnfglaRp6BoGouQI1FCOT6FaXDG Evurzh4mdNjlp0xfdgyfFgDrtT0jPLmgTXLSsrng8yFFkXYgkHeFmNl4X5BXTTbVSiEF eTWp0qbtCylkq+Tqjbs2mbv6ubBvMfNoJ9Hyb3oTZZsswY+a2FQa3PhsqfLNT0PkzvZw 6AQZ3KcbSZB7LUd3eXk1r7p6CdEoSbTchF2iE/8b6NT9RJa1vBusPjvn9abEpfqF7ZHo GY0m93sWzXa7Fi3q2mdE7whJn/EbS2R0XdhafKXCO3825Rn2tVkh2N4JUe/wa9SCVunz IpvQ== X-Gm-Message-State: AMCzsaXVykCj/EtmDHKyhW1qded3DZwEiX/+sv1iYut2KrLoUY845nCS cfc0dYvt+Dap+6xhf/7ZGWw5wyFjEgM= X-Google-Smtp-Source: ABhQp+Qy6NayqeTYqEUtRt1kFzqtWmM10g7uWBxbV9N/GLOPtLJwL4VP2X9L5fLETAvGNstzRAVnDw== X-Received: by 10.28.145.196 with SMTP id t187mr2478882wmd.119.1509370351378; Mon, 30 Oct 2017 06:32:31 -0700 (PDT) Received: from disaster-area.hh.sledj.net (disaster-area.hh.sledj.net. [81.149.164.25]) by smtp.gmail.com with ESMTPSA id l7sm9833803wrg.69.2017.10.30.06.32.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Oct 2017 06:32:29 -0700 (PDT) Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 7058c987; Mon, 30 Oct 2017 13:32:29 +0000 (UTC) To: notmuch@notmuchmail.org Subject: Re: Carbon (macOS) port asks about killing stderr buffer In-Reply-To: References: X-HGTTG: heart-of-gold From: David Edmondson Date: Mon, 30 Oct 2017 13:32:28 +0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 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: Mon, 30 Oct 2017 13:32:36 -0000 On Thursday, 2017-10-26 at 12:32:17 +0100, David Edmondson wrote: > After the changes to use `make-process', the Carbon port of emacs on > macOS (often referred to as emacs-mac or the railwaycat port) will ask > about killing the stderr buffer after any `notmuch-search': > > Debugger entered--Lisp error: (quit) > yes-or-no-p("Buffer \" *notmuch-stderr*-839121\" has a running process; kill it? ") > process-kill-buffer-query-function() > kill-buffer(#) > notmuch-start-notmuch-sentinel(# "finished\n") A hack-and-slash patch for this that works for me: diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 010be454..7c0faee4 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -909,7 +909,7 @@ invoke `set-process-sentinel' directly on the returned process, as that will interfere with the handling of stderr and the exit status." - (let (err-file err-buffer proc + (let (err-file err-buffer proc err-proc ;; Find notmuch using Emacs' `exec-path' (command (or (executable-find notmuch-command) (error "Command not found: %s" notmuch-command)))) @@ -926,11 +926,13 @@ status." :buffer buffer :command (cons command args) :connection-type 'pipe - :stderr err-buffer)) + :stderr err-buffer) + err-proc (get-buffer-process err-buffer)) (process-put proc 'err-buffer err-buffer) - ;; Silence "Process NAME stderr finished" in stderr by adding a - ;; no-op sentinel to the fake stderr process object - (set-process-sentinel (get-buffer-process err-buffer) #'ignore)) + + (process-put err-proc 'err-file err-file) + (process-put err-proc 'err-buffer err-buffer) + (set-process-sentinel err-proc #'notmuch-start-notmuch-error-sentinel)) ;; On Emacs versions before 25, there is no way to capture ;; stdout and stderr separately for asynchronous processes, or @@ -990,9 +992,14 @@ status." ;; Emacs behaves strangely if an error escapes from a sentinel, ;; so turn errors into messages. (message "%s" (error-message-string err)))) - (when err-buffer (kill-buffer err-buffer)) (when err-file (ignore-errors (delete-file err-file))))) +(defun notmuch-start-notmuch-error-sentinel (proc event) + (let* ((err-file (process-get proc 'err-file)) + (err-buffer (or (process-get proc 'err-buffer) + (find-file-noselect err-file)))) + (when err-buffer (kill-buffer err-buffer)))) + ;; This variable is used only buffer local, but it needs to be ;; declared globally first to avoid compiler warnings. (defvar notmuch-show-process-crypto nil) dme. -- Why stay in college? Why go to night school?