help-gnu-emacs
[Top][All Lists]
Advanced

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

Avoid asking to user for lock (ask-user-about-lock)


From: David Capello
Subject: Avoid asking to user for lock (ask-user-about-lock)
Date: Thu, 24 Sep 2015 09:39:51 -0300

Hi there,

I've a package (keyfreq) that tries to add data to a file each X seconds.
To do this it has to create a lock file, write the file, and release/delete
the lock. If two instances of Emacs are running, both instances will try
to write in the file at certain point. And here is where I'm having
troubles
(this was not a problem in Emacs 24.3, but now it is on 24.5).

The problem is here:
https://github.com/dacap/keyfreq/blob/master/keyfreq.el#L427

I'm trying to redefine ask-user-about-lock temporarily so it doesn't
ask to overwrite the .lock file if it already exists (if the lock already
exist, we just "do nothing"/"wait next timeout", because the file is
locked).
Anyway it looks that sometimes, this redefinition doesn't work correctly.

I would like to know if there is a way/common pattern to handle
this kind of situations where two or more instances of Emacs are trying
to add data to a file, and if they cannot get the lock, they just do
nothing and can try it later.

- David


reply via email to

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