Bug in `set-visited-file-name' of 19.22 (Was: Re: EFS 1.6 bug: is this a bug or a feature?)

sandy@ibm550.sissa.it
Thu, 19 May 1994 20:17:31 +0200


>>>>> On Thu, 14 Apr 94 15:26:45 -0400,
      Edward Hartnett <ejh@larry.gsfc.nasa.gov> said:

 > I'm not sure if this is a bug or a feature.

 > I am editing a file on a local machine. I save a copy to a remote
 > machine using C-x C-s user@machine:directory. It saves the file OK,

You mean "C-x C-w"?

 > but changes the name of the buffer from filename to filename<2>, as if
 > I had opened another buffer and read in the same file. But using C-x
 > C-b I see there is only one buffer open, the filename<2> buffer. There
 > is no longer a filename buffer.

This is a bug, but not in efs.  It's a bug in emacs 19.22.

Specifically, `set-visited-file-name' calls
(rename-buffer NEW-NAME t)
where NEW-NAME is the non-directory part of FILENAME, the arg to
`set-visited-file-name'.  If the original name of the buffer, and the
new name of the buffer are the same (this is the case if the new
visited file name and the original visited file name have the same
non-directory parts), then calling `rename-buffer' results in the
buffer getting renamed from NAME to NAME<2>.  `set-visited-file-name'
should only call `rename-buffer', if the name of the buffer needs to
be changed.

I'm not sure if this bug has been fixed in 19.23.

--sandy