Editing Hard Linked Files in Emacs -solution
Jerry Feldman
gaf-mNDKBlG2WHs at public.gmane.org
Sat Dec 27 07:50:18 EST 2008
On 12/26/2008 10:08 PM, David Kramer wrote:
> jbk wrote:
> =20
>> jbk wrote:
>> =20
>>> How do you maintain the hardlink when saving with emacs?=20
>>> Version control? VI won't do.
>>>
>>> =20
>> Well I guess you all are stumped or to busy with the new toys.
>> =20
>
> Well, I didn't get much help either, but I'm assuming it's the holidays=
=2E
>
> =20
>> My work around is to edit the original and save as another then:
>>
>> cat <saveAs> > <originalFile>
>>
>> this works for now.
>> =20
>
> I didn't answer because I don't understand the problem. Are you talkin=
g
> about files that are the same inodes, as created by "ln" without the th=
e
> "-s" option? How could emacs (or any program) possibly change the
> contents of one without changing the contents of the other, since they
> point to the same spot on the disk?
>
> =20
Yes he is talking about a file that has more than 1 link. The way emacs=20
works, is that it renames the original file by appending a tilde (~).=20
So, when you save, you are saving a completely new file. In emacs, this=20
is called version control. You can set version-control in emacs to make=20
numbered backups.
The solution to this is to set the emacs variable, backup-by-copying to=20
non-nil. The way to do this from the emacs minibuffer is "
M-x set-variable". This emacs command will allow you to set the variable.=
It can also be done in your ~/.emacs file. It took me a while to remembe=
r this. Way back when I first learned emacs ('82).
--=20
Jerry Feldman <gaf-mNDKBlG2WHs at public.gmane.org>
Boston Linux and Unix
PGP key id: 537C5846
PGP Key fingerprint: 3D1B 8377 A3C0 A5F2 ECBB CA3B 4607 4319 537C 5846
More information about the Discuss
mailing list