[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Multiple names for "the same" file

Maybe you're right; it isn't clear.  In any event, you never want to have
two buffers pointing at the same file without knowing it.  Perhaps the best
thing is to give a warning, but here is the behavior I expected when I did
just what I described: I expected that I would have gotten "(new file)" on
dir;name >, which would have written out (i.e., C-X C-S) as dir;name 1.
Part of my theory of fn2's is that ">" should try really hard to be numeric;
this unfortunately is a borderline case.  Had I not already had a buffer
for dir;name nonnum, then I would likely have wanted > to refer to nonnum,
but the referent of > shouldn't depend on what buffers you have loaded.
So my conclusion, again: there should be a warning message and probably a
request for y/n confirmation (not yes/no since there's nothing destructive
immediately at stake) every time you try to create a new buffer that points
to the same file as an existing one, in the sense that adding to the new
buffer would cause there to be divergent versions of the file.

Date: Sunday, 11 April 1982  13:51-EST
    From: MOON at SCRC-TENEX
    To:   Philip E. Agre <AGRE at MIT-AI>
    Cc:   BUG-ZWEI at MIT-AI
    Subject: Multiple names for "the same" file

	Date: 10 April 1982 10:38-EST
	From: Philip E. Agre <AGRE at MIT-AI>

	Do C-X C-F on dir;name > for some nonexistent file so as to get a new buffer
	with (new file) for dir;name >.  Type some text at it and then do C-X C-W
	dir;name nonnum for some non-numeric fn2.  Then type some more text at the
	buffer and do C-X C-F dir;name >.  It will read dir;name nonnum from disk and
	give you a second buffer for the same file with the old text.  This is just
	asking for lossage.  I don't know what the right behavior is here but this
	clearly isn't it.
    The same thing happens if the fn2 is numeric.  c-X c-W changes the name of the
    file associated with the buffer.  If you had modified and written out the second
    buffer, it would have written to name >, not name nonnum.  Thus your two buffers
    were in fact holding different files; they were only the same file as long as no
    one created another file that was ">" the original file.  I can't think of any
    behavior that would be better.

    Possibly the editor could print a warning if you do a Find File or Write
    File and there exists another editor buffer whose file had the same
    truename the last time it was read or written.  Note that this is not
    necessarily an error.  For instance, I often have a file read into two
    editor buffers, where one is the version I am modifying and the other is
    the installed version which I am keeping in the editor so I can refer back
    to it.