From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#65414: save-some-buffers-functions are unexpectedly called when save-some-buffers pred is non-nil Date: Sat, 26 Aug 2023 10:26:30 +0300 Message-ID: <838r9ymfh5.fsf@gnu.org> References: <871qfxvvw9.fsf@breatheoutbreathe.in> <83lee4vcac.fsf@gnu.org> <87o7ixe1e2.fsf@breatheoutbreathe.in> <83o7ixqatx.fsf@gnu.org> <87fs46cn6u.fsf@breatheoutbreathe.in> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11158"; mail-complaints-to="usenet@ciao.gmane.io" Cc: jonas@bernoul.li, 65414@debbugs.gnu.org To: Joseph Turner Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 26 09:27:19 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qZnhV-0002Zl-HF for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 26 Aug 2023 09:27:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZnhE-0005LA-LL; Sat, 26 Aug 2023 03:27:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qZnhB-0005Fh-GW for bug-gnu-emacs@gnu.org; Sat, 26 Aug 2023 03:26:57 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qZnhB-0007Or-8P for bug-gnu-emacs@gnu.org; Sat, 26 Aug 2023 03:26:57 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qZnhF-00033n-Si for bug-gnu-emacs@gnu.org; Sat, 26 Aug 2023 03:27:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 26 Aug 2023 07:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65414 X-GNU-PR-Package: emacs Original-Received: via spool by 65414-submit@debbugs.gnu.org id=B65414.169303478211711 (code B ref 65414); Sat, 26 Aug 2023 07:27:01 +0000 Original-Received: (at 65414) by debbugs.gnu.org; 26 Aug 2023 07:26:22 +0000 Original-Received: from localhost ([127.0.0.1]:41632 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qZngc-00032p-59 for submit@debbugs.gnu.org; Sat, 26 Aug 2023 03:26:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52878) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qZngW-00032a-RV for 65414@debbugs.gnu.org; Sat, 26 Aug 2023 03:26:20 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qZngI-0007Lc-Ag; Sat, 26 Aug 2023 03:26:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=v8NceejLzNhwsKQuY8pY/bK1MVm5DsUFnsM8SDI0nLE=; b=e30/3Q6vBB15 pOx2TSDeByoutybgY+sGyLoRLmqd9HRAfBAehSePDbn0LW3WMmfinspwdQkh3iOcxK5cGvF2P4brM LO3ltlHqmMdxt59t5G9hI9544o9YwBUWbgfuFkXPUI67psdmMDwfDTtq5PqkJe2ocmB5kdYv5zBxc sJX4/8C3w/U+kVYqZ0fM4aHAt5cyEmHbxD91guleeYCPAXIQ34uHRxnMBe+XFxR9q+rgC9KWZZTwN 5vb++ux2g0FNQmTNQ6pXj68ylYJqzN1+bbzvorJZCtgmFn2+E0HFm8HUrfg8WuKxy+e8rkHCjk8Fm dNTzp4OncXlXtzzYdI9ycg==; In-Reply-To: <87fs46cn6u.fsf@breatheoutbreathe.in> (message from Joseph Turner on Fri, 25 Aug 2023 23:38:18 -0700) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:268475 Archived-At: > From: Joseph Turner > Cc: 65414@debbugs.gnu.org, jonas@bernoul.li > Date: Fri, 25 Aug 2023 23:38:18 -0700 > > > Eli Zaretskii writes: > > > Why is it undesirable? save-some-buffers always saved abbrevs, didn't > > it? And it did so independently of PRED, right? So how did this > > problem suddenly started affecting Magit? > > > > IOW, I still don't have a clear idea what caused this problem, if > > (AFAIU) it is a problem that started happening recently. > > This problem is not new. However, now that save-some-buffers-functions > has been added, the problem goes beyond abbrevs. > > >> Another example: hyperdrive.el adds to save-some-buffers-functions for > >> saving hyperdrive file buffers: > >> > >> https://git.sr.ht/~ushin/hyperdrive.el/tree/d7dc7a08ba47761108cf98e21ffa2d8dad28f34a/item/hyperdrive.el#L99 > >> > >> After this change, magit-save-repository-buffers now prompts to save > >> irrelevant hyperdrive file buffers. I would like some way to tell > >> hyperdrive--save-some-buffers not to prompt the user to save hyperdrive > >> buffers from inside magit-save-repository-buffers. > > > > Why do you want to do that? Whether or not to prompt the user abides > > by the common protocol defined by save-some-buffers: if it's called > > with the argument ARG non-nil (which should happen interactively when > > the user invokes the command with a prefix argument), there's no > > prompt, otherwise Emacs prompts. Why magit-save-repository-buffers > > wants to break this common protocol? > > I think magit-save-repository-buffers follows the common protocol > correctly. > > > I feel that I'm still missing something important, which causes you to > > want a different behavior from magit-save-repository-buffers. For > > starters, can you describe how magit-save-repository-buffers ends up > > calling save-some-buffers-functions in enough detail for me to > > understand why you think saving these buffers is deemed "undesirable"? > > The issue is not that save-some-buffers prompts instead of saving > without questions. > > What is undesirable to me is that save-some-buffers unconditionally > calls each one of save-some-buffers-functions, regardless of PRED. This > means that when save-some-buffers is used with the intention to save > only a handful of files (as with magit-save-repository-buffers), > save-some-buffers-functions are all called, even when irrelevant. So your problem is with Lisp programs that add functions to save-some-buffers-functions, but don't expect or don't want those functions to be called each time save-some-buffers is invoked? I'm not sure how did those Lisp programs get the idea that save-some-buffers-functions will not be called always -- is it hinted by some documentation somewhere? If not, I'd say that those Lisp programs have a bug that needs to be fixed in those programs. Right? In any case, not calling save-some-buffers-functions when PRED is non-nil is not something we can do, as that would be an incompatible behavior change. We could perhaps add PRED to the arguments with which save-some-buffers-functions are called, as an optional argument. Would that be satisfactory?