unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#62208: 30.0.50; [PATCH] save-some-buffers repeatedly asks for saving abbrev file
@ 2023-03-15 17:42 Filipp Gunbin
  2023-03-15 18:12 ` Filipp Gunbin
  2023-03-16  5:12 ` Eli Zaretskii
  0 siblings, 2 replies; 8+ messages in thread
From: Filipp Gunbin @ 2023-03-15 17:42 UTC (permalink / raw)
  To: 62208


- 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





^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#62208: 30.0.50; [PATCH] save-some-buffers repeatedly asks for saving abbrev file
  2023-03-15 17:42 bug#62208: 30.0.50; [PATCH] save-some-buffers repeatedly asks for saving abbrev file Filipp Gunbin
@ 2023-03-15 18:12 ` Filipp Gunbin
  2023-03-16  5:12 ` Eli Zaretskii
  1 sibling, 0 replies; 8+ messages in thread
From: Filipp Gunbin @ 2023-03-15 18:12 UTC (permalink / raw)
  To: 62208

On 15/03/2023 20:42 +0300, Filipp Gunbin wrote:

> This is a regression since 28.1.

Sorry, since 28.2





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#62208: 30.0.50; [PATCH] save-some-buffers repeatedly asks for saving abbrev file
  2023-03-15 17:42 bug#62208: 30.0.50; [PATCH] save-some-buffers repeatedly asks for saving abbrev file Filipp Gunbin
  2023-03-15 18:12 ` Filipp Gunbin
@ 2023-03-16  5:12 ` Eli Zaretskii
  2023-03-16 14:48   ` Filipp Gunbin
  2023-03-16 19:14   ` Filipp Gunbin
  1 sibling, 2 replies; 8+ messages in thread
From: Eli Zaretskii @ 2023-03-16  5:12 UTC (permalink / raw)
  To: Filipp Gunbin; +Cc: 62208

> From: Filipp Gunbin <fgunbin@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?





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#62208: 30.0.50; [PATCH] save-some-buffers repeatedly asks for saving abbrev file
  2023-03-16  5:12 ` Eli Zaretskii
@ 2023-03-16 14:48   ` Filipp Gunbin
  2023-03-16 19:14   ` Filipp Gunbin
  1 sibling, 0 replies; 8+ messages in thread
From: Filipp Gunbin @ 2023-03-16 14:48 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 62208

On 16/03/2023 07:12 +0200, Eli Zaretskii wrote:

>> From: Filipp Gunbin <fgunbin@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.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#62208: 30.0.50; [PATCH] save-some-buffers repeatedly asks for saving abbrev file
  2023-03-16  5:12 ` Eli Zaretskii
  2023-03-16 14:48   ` Filipp Gunbin
@ 2023-03-16 19:14   ` Filipp Gunbin
  2023-03-16 20:10     ` Eli Zaretskii
  1 sibling, 1 reply; 8+ messages in thread
From: Filipp Gunbin @ 2023-03-16 19:14 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 62208

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





^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#62208: 30.0.50; [PATCH] save-some-buffers repeatedly asks for saving abbrev file
  2023-03-16 19:14   ` Filipp Gunbin
@ 2023-03-16 20:10     ` Eli Zaretskii
  2023-03-17 14:18       ` Filipp Gunbin
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2023-03-16 20:10 UTC (permalink / raw)
  To: Filipp Gunbin; +Cc: 62208

> From: Filipp Gunbin <fgunbin@fastmail.fm>
> Cc: bug-gnu-emacs@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.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#62208: 30.0.50; [PATCH] save-some-buffers repeatedly asks for saving abbrev file
  2023-03-16 20:10     ` Eli Zaretskii
@ 2023-03-17 14:18       ` Filipp Gunbin
  2023-09-06  1:55         ` Stefan Kangas
  0 siblings, 1 reply; 8+ messages in thread
From: Filipp Gunbin @ 2023-03-17 14:18 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 62208

fixed 62208 29.1
quit

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

>> From: Filipp Gunbin <fgunbin@fastmail.fm>
>> Cc: bug-gnu-emacs@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.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#62208: 30.0.50; [PATCH] save-some-buffers repeatedly asks for saving abbrev file
  2023-03-17 14:18       ` Filipp Gunbin
@ 2023-09-06  1:55         ` Stefan Kangas
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan Kangas @ 2023-09-06  1:55 UTC (permalink / raw)
  To: Filipp Gunbin; +Cc: Eli Zaretskii, 62208-done

Filipp Gunbin <fgunbin@fastmail.fm> writes:

> fixed 62208 29.1
> quit
>
> On 16/03/2023 22:10 +0200, Eli Zaretskii wrote:
>
>>> From: Filipp Gunbin <fgunbin@fastmail.fm>
>>> Cc: bug-gnu-emacs@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.





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-09-06  1:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15 17:42 bug#62208: 30.0.50; [PATCH] save-some-buffers repeatedly asks for saving abbrev file Filipp Gunbin
2023-03-15 18:12 ` Filipp Gunbin
2023-03-16  5:12 ` Eli Zaretskii
2023-03-16 14:48   ` Filipp Gunbin
2023-03-16 19:14   ` Filipp Gunbin
2023-03-16 20:10     ` Eli Zaretskii
2023-03-17 14:18       ` Filipp Gunbin
2023-09-06  1:55         ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).