From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: PROPOSAL: Control over process cleanup in `save-buffers-kill-emacs'. Date: Fri, 22 Sep 2017 22:26:48 +0300 Message-ID: <834lrucz5z.fsf@gnu.org> References: <87poai36hq.fsf@red-bean.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1506108431 30350 195.159.176.226 (22 Sep 2017 19:27:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 22 Sep 2017 19:27:11 +0000 (UTC) Cc: emacs-devel@gnu.org To: Karl Fogel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 22 21:27:05 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvTbN-0007Ur-HA for ged-emacs-devel@m.gmane.org; Fri, 22 Sep 2017 21:27:05 +0200 Original-Received: from localhost ([::1]:60733 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dvTbT-0007D5-47 for ged-emacs-devel@m.gmane.org; Fri, 22 Sep 2017 15:27:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47988) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dvTbI-0007BX-7Z for emacs-devel@gnu.org; Fri, 22 Sep 2017 15:27:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dvTbE-0007Iu-99 for emacs-devel@gnu.org; Fri, 22 Sep 2017 15:27:00 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:46489) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dvTbE-0007Iq-53; Fri, 22 Sep 2017 15:26:56 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4880 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dvTbD-0005Qi-8p; Fri, 22 Sep 2017 15:26:56 -0400 In-reply-to: <87poai36hq.fsf@red-bean.com> (message from Karl Fogel on Fri, 22 Sep 2017 13:58:41 -0500) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:218701 Archived-At: > From: Karl Fogel > Date: Fri, 22 Sep 2017 13:58:41 -0500 > > I propose moving `kill-emacs-query-functions' to before the process-killing block, so that hooks can do things with processes before Emacs asks about those processes. I haven't tested this patch yet, but this gives the idea: We have process-query-on-exit-flag for that. > But I can't easily do `set-process-query-on-exit-flag' at the time the IMAP processes are started, since I just run `M-x gnus' and then somewhen after that something runs IMAP (maybe there's a hook for this somewhere, but if so, I haven't found it yet). Then perhaps we need a facility to set this flag on certain classes of processes? > But I could put code like this into a hook, if only there were a hook that were run before the process-killing block in `save-buffers-kill-emacs': > > (mapcar (lambda (buf) > (when (string-match "^ \\*imap source\\*.*" (buffer-name buf)) > (message "shutting down IMAP process '%s'" (get-buffer-process buf)) > (set-process-query-on-exit-flag (get-buffer-process buf) nil) > (kill-buffer buf))) > (buffer-list)) Why cannot you do something similar in the process sentinel, which is called when the process begins? Or maybe Gnus should provide a facility to set this flag for the processes it starts? In any case, if this is somehow impossible today, I think we should extend the facilities that allow setting this flag, instead of inventing a separate parallel mechanism. Thanks.