From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" 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 00:32:23 -0700 Message-ID: <874jkmck9j.fsf@breatheoutbreathe.in> References: <871qfxvvw9.fsf@breatheoutbreathe.in> <83lee4vcac.fsf@gnu.org> <87o7ixe1e2.fsf@breatheoutbreathe.in> <83o7ixqatx.fsf@gnu.org> <87fs46cn6u.fsf@breatheoutbreathe.in> <838r9ymfh5.fsf@gnu.org> Reply-To: Joseph Turner Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13667"; mail-complaints-to="usenet@ciao.gmane.io" Cc: jonas@bernoul.li, 65414@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 26 09:54:10 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 1qZo7V-0003Nv-Si for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 26 Aug 2023 09:54:10 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZo7L-0000aw-4q; Sat, 26 Aug 2023 03:53:59 -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 1qZo7J-0000aY-F7 for bug-gnu-emacs@gnu.org; Sat, 26 Aug 2023 03:53: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 1qZo7I-0003Al-Po for bug-gnu-emacs@gnu.org; Sat, 26 Aug 2023 03:53:56 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qZo7N-0003oy-Q7 for bug-gnu-emacs@gnu.org; Sat, 26 Aug 2023 03:54:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Joseph Turner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 26 Aug 2023 07:54: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.169303640714628 (code B ref 65414); Sat, 26 Aug 2023 07:54:01 +0000 Original-Received: (at 65414) by debbugs.gnu.org; 26 Aug 2023 07:53:27 +0000 Original-Received: from localhost ([127.0.0.1]:41668 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qZo6o-0003ns-PG for submit@debbugs.gnu.org; Sat, 26 Aug 2023 03:53:27 -0400 Original-Received: from out-247.mta1.migadu.com ([95.215.58.247]:62839) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qZo6l-0003ne-CC for 65414@debbugs.gnu.org; Sat, 26 Aug 2023 03:53:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; s=key1; t=1693036396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=KbS91jLttEdsJovAi+Cy6YesCiY/DvRR/m9LEhbRrnQ=; b=HP9QkNihWw3icLXhDbcRTzAm6VeAIxvCc3vUhLu0CtdB/Gg4QUwzbQdISCn99OfA8uUhja h0DmFNvBY+fItmrhfpaWzRMUIVCDOvnMkA2CAXwS3W5hz50h7OL2kZsLI6EX0hRWTHvL2w Oa+vDnjlxVXsuBGNNTt1bMf4VqKtvSA= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-reply-to: <838r9ymfh5.fsf@gnu.org> X-Migadu-Flow: FLOW_OUT 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:268481 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: > 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? Yes. > 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? I agree. > 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? Yes, that would solve the interference between Magit and hyperdrive.el. See patch. Thank you! Joseph --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Pass-PRED-to-each-of-save-some-buffers-functions.patch >From 28e8745b579da5f83afc7f9eb5b5ed2df2f3204e Mon Sep 17 00:00:00 2001 From: Joseph Turner Date: Sat, 26 Aug 2023 00:50:28 -0700 Subject: [PATCH] Pass PRED to each of save-some-buffers-functions * lisp/abbrev.el (abbrev--possibly-save): Ignore PRED * lisp/files.el (save-some-buffers-functions): Fix documentation (save-some-buffers): Pass PRED to each of save-some-buffers-functions --- lisp/abbrev.el | 2 +- lisp/files.el | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/abbrev.el b/lisp/abbrev.el index e1311dbc83b..43e7c7e5e5d 100644 --- a/lisp/abbrev.el +++ b/lisp/abbrev.el @@ -1242,7 +1242,7 @@ which see." '(edit-abbrevs-mode-font-lock-keywords nil nil ((?_ . "w")))) (setq font-lock-multiline nil)) -(defun abbrev--possibly-save (query &optional arg) +(defun abbrev--possibly-save (query &optional arg _pred) ;; Query mode. (if (eq query 'query) (and save-abbrevs abbrevs-changed) diff --git a/lisp/files.el b/lisp/files.el index 29d109ab385..6ab10cc3310 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -6003,8 +6003,8 @@ function should return non-nil if there is something to be saved (but it should not actually save anything). If the first argument is something else, then the function should -save according to the value of the second argument, which is the -ARG argument from `save-some-buffers'.") +save according to the values of the second and third arguments, +which are the ARG and PRED arguments from `save-some-buffers'.") (defun save-some-buffers (&optional arg pred) "Save some modified file-visiting buffers. Asks user about each one. @@ -6099,7 +6099,7 @@ after saving the buffers." save-some-buffers-action-alist)) ;; Allow other things to be saved at this time, like abbrevs. (dolist (func save-some-buffers-functions) - (setq inhibit-message (or (funcall func nil arg) inhibit-message))) + (setq inhibit-message (or (funcall func nil arg pred) inhibit-message))) (or queried (> files-done 0) inhibit-message (cond ((null autosaved-buffers) -- 2.41.0 --=-=-=--