[comp.emacs] Emacs kills hard links!

maujf@daisy.warwick.ac.uk (Mike Taylor) (01/15/88)

Hello world!

This is my first posting to this group, since I've been using ded all my
life, but since I changed to emacs, I have been stunned to find that when
overwriting a linked file, emacs destroys the links, leaving me with only
one version of the file changed.  OK, so I could always re-link them
afterwards, in fact that's exactly what I *do* do, but it's messy, and
frankly I can do without it.  

I guess those of you who have been using Emacs since the dawn of time will
have heard all this many times before, but could anyone tell me a neat and
simple way around this?  Maybe something I can put in my .emacs file so
that it maintains links with edited files?

Thanks very much.  And have a nice day!

hansen@mips.UUCP (01/16/88)

In article <400@sol.warwick.ac.uk>, maujf@daisy.warwick.ac.uk (Mike Taylor) writes:
>     ...since I changed to emacs, I have been stunned to find that when
> overwriting a linked file, emacs destroys the links, leaving me with only
> one version of the file changed.
> 
> I guess those of you who have been using Emacs since the dawn of time will
> have heard all this many times before, but could anyone tell me a neat and
> simple way around this?  Maybe something I can put in my .emacs file so
> that it maintains links with edited files?

Put the following in your .emacs to cause hard links to be retained:
(setq backup-by-copying-when-linked t)

The following line will also keep the file modes and ownership retained:
(setq backup-bn-copying-when-mismatch t)

Now, can anyone tell me how to get emacs to understand that if
/user/hansen is a symbolic link to /n/electron/vlsi/hansen, that
/user/hansen/.emacs is the same as /n/electron/vlsi/hansen/.emacs, so
it won't open two separate buffers for the same file??? [This occurs
if, while starting with /user/hansen as your current directory, you
enter "emacs .emacs" and then later do a find-file on
"/user/hansen/.emacs"]
-- 
Craig Hansen
Manager, Architecture Development
MIPS Computer Systems, Inc.
...{ames,decwrl,prls}!mips!hansen or hansen@mips.com

wesommer@athena.mit.edu (William E. Sommerfeld) (01/16/88)

In article <400@sol.warwick.ac.uk> maujf@opal.warwick.ac.uk (Mike Taylor) writes:
>I have been stunned to find that when
>overwriting a linked file, emacs destroys the links, leaving me with only
>one version of the file changed.  

>Maybe something I can put in my .emacs file so
>that it maintains links with edited files?

Ok, how about:

(setq backup-by-copying-when-linked t)

backup-by-copying-when-linked's value is t

Documentation:
*Non-nil means use copying to create backups for files with multiple names.
This causes the alternate names to refer to the latest version as edited.
This variable is relevant only if  backup-by-copying  is nil.

This is even documented in the emacs manual, although it is listed
under "backups", not "saving".

					Bill Sommerfeld
					wesommer@athena.mit.edu