Subject: bug#54401: 28.0.91; Buffer visited file replaced with lockfile location

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 17 Mar 2022 12:20:37 +0100

Kenny Ballou <[email-masked]> writes:

> This may be a "won't-fix", but I seemed to have stumbled onto an issue where
> the visited file of the current buffer is replaced by the lock file location on
> file renames when using `auto-save-visited-file-name`.
>
> The minimal configuration (`emacs -Q`) to trigger the bug is the following:
>
> ```
> (setq auto-save-visited-file-name t)
> (setq auto-save-default t)
> (setq auto-save-timeout 20)
> (setq auto-save-interval 20)

You only need the first, apparently.  And there's more bugginess going
on than described.

In Emacs 29:

emacs -Q
M-: (setq auto-save-visited-file-name t) RET
C-x C-f /tmp/foo1 RET
<type something> `C-x C-s'

Observe that the /tmp/foo1 file exists.

`C-x C-w /tmp/foo2 RET'

/tmp/foo1 no longer exists!  But /tmp/foo2 does.

<type something>
`M-x do-auto-save RET'

/tmp/#foo2# now exists!  And `buffer-file-name' in the "foo2" buffer is
now "/tmp/#foo2#'

So this is kinda totally broken.  Now, `auto-save-visited-file-name' was
made obsolete in Emacs 26.1, but perhaps these things should be fixed
anyway.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no