From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#31951: 27.0.50; [PATCH] server-save-buffers-kill-terminal should respect save-some-buffers-default-predicate Date: Mon, 25 Jun 2018 12:07:26 +0100 Message-ID: <8736xbm8ep.fsf@gmail.com> References: <87y3f5mq07.fsf@gmail.com> <87vaa8pap5.fsf@gmail.com> <87muvklysn.fsf@gmail.com> <87r2kvq5f9.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1529924915 26527 195.159.176.226 (25 Jun 2018 11:08:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 25 Jun 2018 11:08:35 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 31951@debbugs.gnu.org To: Noam Postavsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jun 25 13:08:31 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1fXPMD-0006pP-Tf for geb-bug-gnu-emacs@m.gmane.org; Mon, 25 Jun 2018 13:08:30 +0200 Original-Received: from localhost ([::1]:45488 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXPOL-0000dq-3z for geb-bug-gnu-emacs@m.gmane.org; Mon, 25 Jun 2018 07:10:41 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53924) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXPLs-000757-Km for bug-gnu-emacs@gnu.org; Mon, 25 Jun 2018 07:08:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fXPLm-0003bS-NY for bug-gnu-emacs@gnu.org; Mon, 25 Jun 2018 07:08:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:54654) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fXPLm-0003aX-HJ for bug-gnu-emacs@gnu.org; Mon, 25 Jun 2018 07:08:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fXPLm-0003u8-4j for bug-gnu-emacs@gnu.org; Mon, 25 Jun 2018 07:08:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 25 Jun 2018 11:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31951 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 31951-submit@debbugs.gnu.org id=B31951.152992485814977 (code B ref 31951); Mon, 25 Jun 2018 11:08:02 +0000 Original-Received: (at 31951) by debbugs.gnu.org; 25 Jun 2018 11:07:38 +0000 Original-Received: from localhost ([127.0.0.1]:34317 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fXPLN-0003tU-TP for submit@debbugs.gnu.org; Mon, 25 Jun 2018 07:07:38 -0400 Original-Received: from mail-wm0-f65.google.com ([74.125.82.65]:37837) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fXPLM-0003tJ-8I for 31951@debbugs.gnu.org; Mon, 25 Jun 2018 07:07:36 -0400 Original-Received: by mail-wm0-f65.google.com with SMTP id r125-v6so9497395wmg.2 for <31951@debbugs.gnu.org>; Mon, 25 Jun 2018 04:07:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=YG+LzzBByAZ+upkkjcStE/HUGQSdxjNU+K+DWeWqvik=; b=D55oMxStZzZC5YD5crVicq0Yps4cDbidS5pT7txjLCAXlZ2Qv3MsT3AQVxrbASGeN7 C/ggJfARSoKMG0LV0K0M4JelNzYIcyCUGEpi6fCJcwZav7S+cm6Xz7wMTA85OQooIReD zenK5irU+LF1fj9u+YAqbYrrRbo31rZA2/0nTAXSV361z7N6VPkYroyQ3Sdmw8zS+7Nz DObmsRWXD16rRDFR3ykKUjkRiN5z2VbgAZmK3YIc1jtM9ilLLEOwEBvlHLtqh5kTcbUl eXQEpRH1DGDeDcCvBpYTcQZLVRhJNIo2m1OkmBFESapaaJuYTum5Q3sCsImaPtxMGq4w nomw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=YG+LzzBByAZ+upkkjcStE/HUGQSdxjNU+K+DWeWqvik=; b=EXsNtBX5yyBADCNnNnlmAykhP/OiHFoCLFuCGgPtKITHv8auV3wOxA3RFSbxd02Ul1 r758ZUD0ewCx09ZplnFRSwFytCProJizTF/UlLBLdJJQvwMxZJWMvmufhEjrUp808GLf n+yQYhvX/aYBrnLKUv2n7rRtG5TtHuN2MH77oS0+rYa9wVWexE19yFqMIjM9rlbWhDiW nUbvNMhD9YEuUV3o82l8s4DTf/GadXWqjHoOUWX3N1aTVhBzNYnbmcmFKWNXdgMBp5UJ MoNjIvDleJS9qjDYzNtpPcu3/fUG3uwGIhIKCTkMai8m+WcW8CPdKQnFkWtRITgPa4/X dIag== X-Gm-Message-State: APt69E19MhYrEN5bdgOHk2p54o0U/ILvAFa69iV1IyJUZKk22XrJOuQq jspnMOne7JyJJD/+XNBt6qNr7stx X-Google-Smtp-Source: AAOMgpdR+EmKZMRb1ftXwTjKcWmEK/BSLKoXHNWqA7Ehf+tLENOReOCLgz4UhuhvyimY1zAdU6cg/w== X-Received: by 2002:a1c:c44c:: with SMTP id u73-v6mr597405wmf.99.1529924850274; Mon, 25 Jun 2018 04:07:30 -0700 (PDT) Original-Received: from lolita.yourcompany.com (188.139.62.94.rev.vodafone.pt. [94.62.139.188]) by smtp.gmail.com with ESMTPSA id j131-v6sm17508627wmg.24.2018.06.25.04.07.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Jun 2018 04:07:29 -0700 (PDT) In-Reply-To: <87r2kvq5f9.fsf@gmail.com> (Noam Postavsky's message of "Sun, 24 Jun 2018 16:46:02 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:147806 Archived-At: Noam Postavsky writes: > Jo=C3=A3o T=C3=A1vora writes: > >>> (defun save-buffers-kill-emacs (&optional arg) >>> [...] >>> ;; Don't use save-some-buffers-default-predicate, because we want >>> ;; to ask about all the buffers before killing Emacs. >>> (save-some-buffers arg t) >> >> Right, but thats because, when killing Emacs, it is really the last >> chance to save those buffers before they're potentially gone for good. > > Oh, I got mixed up by the comment in server-save-buffers-kill-terminal: > > ;; If client is bufferless, emulate a normal Emacs exit > ;; and offer to save all buffers. Otherwise, offer to > ;; save only the buffers belonging to the client. > > So I'd say your change is sensible, we should just update that comment > to explain the differences in the "emulation". Hmmmm OK, what about: diff --git a/lisp/server.el b/lisp/server.el index ff03cbe622..33e88409ca 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -1666,13 +1666,16 @@ server-save-buffers-kill-terminal (save-buffers-kill-emacs arg))) ((processp proc) (let ((buffers (process-get proc 'buffers))) - ;; If client is bufferless, emulate a normal Emacs exit - ;; and offer to save all buffers. Otherwise, offer to - ;; save only the buffers belonging to the client. + ;; If the client has buffers, offer to save only those + ;; buffers. Otherwise, this is similar to a normal Emacs + ;; exit (where we offer to save all buffers) with the + ;; exception that, if ARG is nil, then passing nil as the + ;; PRED argument to `save-some-buffers' ensures + ;; `save-some-buffers-default-predicate' is respected. (save-some-buffers arg (if buffers (lambda () (memq (current-buffer) buffers)) - t)) + (and arg t))) (server-delete-client proc))) (t (error "Invalid client frame"))))) I tried to make it terser, but couldn't. If the indentation looks off, it's not, it's because I untabified the changed regions. If nobody complains I'll push this in a few days' time. Jo=C3=A3o