all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Avoid asking to user for lock (ask-user-about-lock)
@ 2015-09-24 12:39 David Capello
  2015-09-24 15:52 ` Stefan Monnier
  2015-09-24 20:42 ` David Capello
  0 siblings, 2 replies; 9+ messages in thread
From: David Capello @ 2015-09-24 12:39 UTC (permalink / raw)
  To: help-gnu-emacs

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-10-20 14:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-24 12:39 Avoid asking to user for lock (ask-user-about-lock) David Capello
2015-09-24 15:52 ` Stefan Monnier
2015-09-24 20:42 ` David Capello
2015-09-24 21:10   ` Stefan Monnier
2015-09-24 21:33     ` David Capello
2015-09-25  1:22       ` Stefan Monnier
2015-09-25  2:08       ` David Capello
2015-09-25 11:05         ` Fwd: " David Capello
2015-10-20 14:20           ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.