Subject: Re: bug#78435: 30.1; abbrev-edit-save-buffer doesn't reset abbrevs-changed OR...

From: Eli Zaretskii <[email-masked]>
Date: Sat, 17 May 2025 13:01:46 +0300

> Date: Wed, 14 May 2025 18:45:00 -0500
> From: Rick <[email-masked]>
> 
> Given:
>     1) Starting with -Q  does exhibit the problem but I can't reconfigure just now
>     2) I don't use client mode
>     3) (save-abbrevs 'silently) ;; is required to exhibit problem 
> 
> M-x edit-abbrev
> Make any arbitrary change
> C-x C-s                                    ;; save the changes
> M-x  kill-buffer                     ;; optional
> M-: abbrevs-changed  yields  t       ;; flag is still set despite changes being saved
> 
> Click the application [x] (top right corner of the frame) to exit Emacs.  
> 
> Expectation:
>     Since there are no unsaved changes, Emacs should exit normally.
>     Even if the changes are somehow technically still considered unsaved (although 
> I can't see why) the save should still be silent.  Or, in the case of (save-abbrevs t)
> there doesn't seem to be a way to tell that it's the abbrevs that want saving so
> deciding how to answer is a dilemma.
> 
> What actually happens:
>     Emacs prompts if I want to save unsaved changes before quitting but gives no 
> indication of what changes are outstanding.  No buffers are visiting files so
> troubleshooting was arduous until I noticed the correlation with abbrev-mode.
> 
> As a temporary fix I did this:
> 
> (defadvice abbrev-edit-save-buffer (after my-abbrev-edit-save-buffer last activate)
>   "Insure that abbrevs-changed is reset after abbrevs are saved."
>   (setq abbrevs-changed nil)
> )
> 
> I see no drawbacks to the setq being in abbrev-edit-save-buffer since the target
> file in that function is the canonical abbrev-file-name.  Otherwise, only the
> abbrev--possibly-save hook on save-some-buffers-functions ever resets it.

Thanks, I've installed that change on the emacs-30 branch, and I'm
therefore closing this bug.