emacs-devel
[Top][All Lists]
Advanced

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

Re: persistent file locks


From: Eli Zaretskii
Subject: Re: persistent file locks
Date: Thu, 06 Feb 2014 10:34:56 +0200

> From: Michael Heerdegen <address@hidden>
> Date: Thu, 06 Feb 2014 07:57:52 +0100
> 
> Thanks.  That would work, but it would mean that I would either
> pollute some user's directory with lots of differently named log files,
> or I would have to implement some merging/removing mechanism for those.

I don't see why would you need all that complexity.  But then I don't
really understand what are your requirements for this feature.  Would
you care to state them?

> I would prefer a solution with a constant log file name (additional
> Emacs processes would just avoid logging if the file is locked, or
> alternatively log into a different file named emacs-log~2 or so).
> 
> Eli, does your answer imply that there are only workaround solutions,
> i.e., that there is no clean way to avoid automatic lock removal by
> Emacs?

I don't understand why would you need to lock the file in the first
place.  For starters, Emacs is quite capable of using the same file
from more than one session: it closes the file as soon as write-region
does its job.  If you want to distinguish between log entries from
different sessions, you can have the Emacs PID be part of the entry.

Lock files are a nuisance, because they need to be removed at the
right moment, and cause annoying user prompts if they aren't (e.g., if
Emacs crashed).  If I were you, I'd like to avoid that if possible.

As for using the user-lock feature: it is not intended to be used for
anything but what it is used now, and for that, it removes the lock as
soon as the file is saved or made unmodified in any other way.  It
will also do nothing if you try locking a file that is already locked
by the same Emacs session, which is probably not what you want.  And
it cannot be customized, i.e. the name of the lock file and its
contents cannot be controlled by a Lisp program.  So I don't think it
fits your bill.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]