GNU bug report logs - #62208
30.0.50; [PATCH] save-some-buffers repeatedly asks for saving abbrev file

Previous Next

Package: emacs;

Reported by: Filipp Gunbin <fgunbin <at> fastmail.fm>

Date: Wed, 15 Mar 2023 17:43:02 UTC

Severity: normal

Tags: patch

Found in version 30.0.50

Fixed in version 29.1

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 62208 in the body.
You can then email your comments to 62208 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#62208; Package emacs. (Wed, 15 Mar 2023 17:43:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Filipp Gunbin <fgunbin <at> fastmail.fm>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 15 Mar 2023 17:43:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Filipp Gunbin <fgunbin <at> fastmail.fm>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; [PATCH] save-some-buffers repeatedly asks for saving
 abbrev file
Date: Wed, 15 Mar 2023 20:42:31 +0300
- emacs -Q
- Define an abbrev using C-x a g
- C-x s, answer "yes"
- Repeat C-x s, it again asks to save abbrevs

This is a regression since 28.1.


diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index ef8ef1ab5a6..1a665efb0a5 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -1250,17 +1250,17 @@ abbrev--possibly-save
     ;; asked to.
     (and save-abbrevs
          abbrevs-changed
-         (progn
-	   (if (or arg
-		   (eq save-abbrevs 'silently)
-		   (y-or-n-p (format "Save abbrevs in %s? " abbrev-file-name)))
-	       (progn
-                 (write-abbrev-file nil)
-                 nil)
-	     ;; Don't keep bothering user if they say no.
-	     (setq abbrevs-changed nil)
-             ;; Inhibit message in `save-some-buffers'.
-	     t)))))
+         (prog1
+	     (if (or arg
+		     (eq save-abbrevs 'silently)
+		     (y-or-n-p (format "Save abbrevs in %s? " abbrev-file-name)))
+	         (progn
+                   (write-abbrev-file nil)
+                   nil)
+               ;; Inhibit message in `save-some-buffers'.
+	       t)
+           ;; Don't ask again whether saved or user said no.
+           (setq abbrevs-changed nil)))))
 
 (add-hook 'save-some-buffers-functions #'abbrev--possibly-save)



In GNU Emacs 30.0.50 (build 3, x86_64-apple-darwin20.6.0, NS
 appkit-2202.70 Version 11.7 (Build 20G817)) of 2023-03-15 built on
 fgunbin.local
Repository revision: 67a660eb13818a620b301775065c4819a2178428
Repository branch: master
System Description:  macOS 11.7




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62208; Package emacs. (Wed, 15 Mar 2023 18:14:01 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Filipp Gunbin <fgunbin <at> fastmail.fm>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#62208: 30.0.50; [PATCH] save-some-buffers repeatedly asks
 for saving abbrev file
Date: Wed, 15 Mar 2023 21:12:59 +0300
On 15/03/2023 20:42 +0300, Filipp Gunbin wrote:

> This is a regression since 28.1.

Sorry, since 28.2




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62208; Package emacs. (Thu, 16 Mar 2023 05:13:01 GMT) Full text and rfc822 format available.

Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Filipp Gunbin <fgunbin <at> fastmail.fm>
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#62208: 30.0.50;
 [PATCH] save-some-buffers repeatedly asks for saving abbrev file
Date: Thu, 16 Mar 2023 07:12:41 +0200
> From: Filipp Gunbin <fgunbin <at> fastmail.fm>
> Date: Wed, 15 Mar 2023 20:42:31 +0300
> 
> 
> - emacs -Q
> - Define an abbrev using C-x a g
> - C-x s, answer "yes"
> - Repeat C-x s, it again asks to save abbrevs
> 
> This is a regression since 28.1.

Thanks, but do you happen to know which change introduced this
regression?  If so, can you point to that change?

Also, would it be possible to add a test for this issue?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62208; Package emacs. (Thu, 16 Mar 2023 14:49:01 GMT) Full text and rfc822 format available.

Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Filipp Gunbin <fgunbin <at> fastmail.fm>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#62208: 30.0.50; [PATCH] save-some-buffers repeatedly asks
 for saving abbrev file
Date: Thu, 16 Mar 2023 17:48:07 +0300
On 16/03/2023 07:12 +0200, Eli Zaretskii wrote:

>> From: Filipp Gunbin <fgunbin <at> fastmail.fm>
>> Date: Wed, 15 Mar 2023 20:42:31 +0300
>> 
>> 
>> - emacs -Q
>> - Define an abbrev using C-x a g
>> - C-x s, answer "yes"
>> - Repeat C-x s, it again asks to save abbrevs
>> 
>> This is a regression since 28.1.
>
> Thanks, but do you happen to know which change introduced this
> regression?  If so, can you point to that change?

It was in 1cfb89dc79b76923c1c93cb44e3e4836b6a8c2bf, here's the previous code:

-          (and save-abbrevs abbrevs-changed
-	       (progn
-	         (if (or arg
-		         (eq save-abbrevs 'silently)
-		         (y-or-n-p (format "Save abbrevs in %s? "
-                                           abbrev-file-name)))
-		     (write-abbrev-file nil))
-	         ;; Don't keep bothering user if he says no.
-	         (setq abbrevs-changed nil)
-	         (setq abbrevs-done t)))

Note (setq abbrevs-changed nil) is outside of if.

> Also, would it be possible to add a test for this issue?

Yeah, I'll try to.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62208; Package emacs. (Thu, 16 Mar 2023 19:15:02 GMT) Full text and rfc822 format available.

Message #17 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Filipp Gunbin <fgunbin <at> fastmail.fm>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#62208: 30.0.50; [PATCH] save-some-buffers repeatedly asks
 for saving abbrev file
Date: Thu, 16 Mar 2023 22:14:01 +0300
On 16/03/2023 07:12 +0200, Eli Zaretskii wrote:

> Also, would it be possible to add a test for this issue?

Now added test, full patch is below.

If/when it's fine, where should I install this?

Thanks.


diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index ef8ef1ab5a6..1a665efb0a5 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -1250,17 +1250,17 @@ abbrev--possibly-save
     ;; asked to.
     (and save-abbrevs
          abbrevs-changed
-         (progn
-	   (if (or arg
-		   (eq save-abbrevs 'silently)
-		   (y-or-n-p (format "Save abbrevs in %s? " abbrev-file-name)))
-	       (progn
-                 (write-abbrev-file nil)
-                 nil)
-	     ;; Don't keep bothering user if they say no.
-	     (setq abbrevs-changed nil)
-             ;; Inhibit message in `save-some-buffers'.
-	     t)))))
+         (prog1
+	     (if (or arg
+		     (eq save-abbrevs 'silently)
+		     (y-or-n-p (format "Save abbrevs in %s? " abbrev-file-name)))
+	         (progn
+                   (write-abbrev-file nil)
+                   nil)
+               ;; Inhibit message in `save-some-buffers'.
+	       t)
+           ;; Don't ask again whether saved or user said no.
+           (setq abbrevs-changed nil)))))
 
 (add-hook 'save-some-buffers-functions #'abbrev--possibly-save)
 
diff --git a/test/lisp/abbrev-tests.el b/test/lisp/abbrev-tests.el
index ecca21df4bc..79ec51ba4d0 100644
--- a/test/lisp/abbrev-tests.el
+++ b/test/lisp/abbrev-tests.el
@@ -305,6 +305,22 @@ test-abbrev-table-p
   (should-not (abbrev-table-p translation-table-vector))
   (should (abbrev-table-p (make-abbrev-table))))
 
+(ert-deftest abbrev--possibly-save-test ()
+  "Test that `abbrev--possibly-save' propertly resets
+`abbrevs-changed'."
+  (ert-with-temp-file temp-test-file
+    (let ((abbrev-file-name temp-test-file)
+          (save-abbrevs t))
+      ;; Save
+      (let ((abbrevs-changed t))
+        (should-not (abbrev--possibly-save nil t))
+        (should-not abbrevs-changed))
+      ;; Don't save
+      (let ((abbrevs-changed t))
+        (ert-simulate-keys '(?n)
+          (should (abbrev--possibly-save nil)))
+        (should-not abbrevs-changed)))))
+
 (provide 'abbrev-tests)
 
 ;;; abbrev-tests.el ends here




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62208; Package emacs. (Thu, 16 Mar 2023 20:12:02 GMT) Full text and rfc822 format available.

Message #20 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Filipp Gunbin <fgunbin <at> fastmail.fm>
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#62208: 30.0.50; [PATCH] save-some-buffers repeatedly asks
 for saving abbrev file
Date: Thu, 16 Mar 2023 22:10:48 +0200
> From: Filipp Gunbin <fgunbin <at> fastmail.fm>
> Cc: bug-gnu-emacs <at> gnu.org
> Date: Thu, 16 Mar 2023 22:14:01 +0300
> 
> On 16/03/2023 07:12 +0200, Eli Zaretskii wrote:
> 
> > Also, would it be possible to add a test for this issue?
> 
> Now added test, full patch is below.
> 
> If/when it's fine, where should I install this?

Thanks, please install on the emacs-29 branch.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62208; Package emacs. (Fri, 17 Mar 2023 14:19:02 GMT) Full text and rfc822 format available.

Message #23 received at 62208 <at> debbugs.gnu.org (full text, mbox):

From: Filipp Gunbin <fgunbin <at> fastmail.fm>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 62208 <at> debbugs.gnu.org
Subject: Re: bug#62208: 30.0.50; [PATCH] save-some-buffers repeatedly asks
 for saving abbrev file
Date: Fri, 17 Mar 2023 17:18:08 +0300
fixed 62208 29.1
quit

On 16/03/2023 22:10 +0200, Eli Zaretskii wrote:

>> From: Filipp Gunbin <fgunbin <at> fastmail.fm>
>> Cc: bug-gnu-emacs <at> gnu.org
>> Date: Thu, 16 Mar 2023 22:14:01 +0300
>> 
>> On 16/03/2023 07:12 +0200, Eli Zaretskii wrote:
>> 
>> > Also, would it be possible to add a test for this issue?
>> 
>> Now added test, full patch is below.
>> 
>> If/when it's fine, where should I install this?
>
> Thanks, please install on the emacs-29 branch.

Installed and closing this bug, thanks.




bug Marked as fixed in versions 29.1. Request was from Filipp Gunbin <fgunbin <at> fastmail.fm> to control <at> debbugs.gnu.org. (Fri, 17 Mar 2023 14:19:02 GMT) Full text and rfc822 format available.

Reply sent to Stefan Kangas <stefankangas <at> gmail.com>:
You have taken responsibility. (Wed, 06 Sep 2023 01:56:02 GMT) Full text and rfc822 format available.

Notification sent to Filipp Gunbin <fgunbin <at> fastmail.fm>:
bug acknowledged by developer. (Wed, 06 Sep 2023 01:56:02 GMT) Full text and rfc822 format available.

Message #30 received at 62208-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Filipp Gunbin <fgunbin <at> fastmail.fm>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 62208-done <at> debbugs.gnu.org
Subject: Re: bug#62208: 30.0.50; [PATCH] save-some-buffers repeatedly asks for
 saving abbrev file
Date: Tue, 5 Sep 2023 18:55:11 -0700
Filipp Gunbin <fgunbin <at> fastmail.fm> writes:

> fixed 62208 29.1
> quit
>
> On 16/03/2023 22:10 +0200, Eli Zaretskii wrote:
>
>>> From: Filipp Gunbin <fgunbin <at> fastmail.fm>
>>> Cc: bug-gnu-emacs <at> gnu.org
>>> Date: Thu, 16 Mar 2023 22:14:01 +0300
>>>
>>> On 16/03/2023 07:12 +0200, Eli Zaretskii wrote:
>>>
>>> > Also, would it be possible to add a test for this issue?
>>>
>>> Now added test, full patch is below.
>>>
>>> If/when it's fine, where should I install this?
>>
>> Thanks, please install on the emacs-29 branch.
>
> Installed and closing this bug, thanks.

This seems ho have accidentally been left open, so I'm closing it now.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 04 Oct 2023 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 205 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.