🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #100091

Autosave file name problem

#100091
From: drw
Date: Sat, 04 Nov 1989 06:46
37 lines
2023 bytes
Problem: Two Emacs's which happen to have buffers of the same name and
same default directory, both with auto-saving enabled, but no
associated file name, will construct the same name for the auto-save
files.  Thus autosaves from each Emacs will interfere with autosaves
from the other.

(This is not unlikely as it seems -- suppose two people routinely log
in with the same account name, or one person runs more than one
Emacs.  Or if two people tend to make the same temporary buffer names,
and tend to edit files in the same directories, by chance this
condition will sometimes arise.)

Suggested solution:  Change make-auto-save-file-name to include
Emacs's process number for buffers that have no file name:

    (defun make-auto-save-file-name ()
      "Return file name to use for auto-saves of current buffer.
    Does not consider auto-save-visited-file-name; that is checked
    before calling this function.
    You can redefine this for customization.
    See also auto-save-file-name-p."
      (if buffer-file-name
	  (concat (file-name-directory buffer-file-name)
		  "#"
		  (file-name-nondirectory buffer-file-name)
		  "#")
	(expand-file-name
	  (concat "#%" (buffer-name) (make-temp-name "-") "#"))))
				     ^^^^^^^^^^^^^^^^^^^^

The resulting file name has the format:

	(default-directory) / # % (buffer-name) - (temp-name) #

(This fix solves a manifestation of this problem in Emerge.)

Dale		drw@math.mit.edu
Technical Details
Message-ID: <8911040646.AA02842@borel.mit.edu>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!BOURBAKI.MIT.EDU!drw

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,c21d5a2d5e164032,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1989-11-04 16:00:42 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!BOURBAKI.MIT.EDU!drw
From: drw@BOURBAKI.MIT.EDU
Newsgroups: gnu.emacs.bug
Subject: Autosave file name problem
Message-ID: <8911040646.AA02842@borel.mit.edu>
Date: 4 Nov 89 06:46:35 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 37
Posted: Sat Nov  4 07:46:35 1989