From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Capello Newsgroups: gmane.emacs.help Subject: Avoid asking to user for lock (ask-user-about-lock) Date: Thu, 24 Sep 2015 09:39:51 -0300 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1443100706 17872 80.91.229.3 (24 Sep 2015 13:18:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 24 Sep 2015 13:18:26 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Sep 24 15:18:24 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Zf6Pm-0000ZK-DW for geh-help-gnu-emacs@m.gmane.org; Thu, 24 Sep 2015 15:18:22 +0200 Original-Received: from localhost ([::1]:34965 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf6Pl-0001RU-Tv for geh-help-gnu-emacs@m.gmane.org; Thu, 24 Sep 2015 09:18:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52519) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf5or-0002sE-J9 for help-gnu-emacs@gnu.org; Thu, 24 Sep 2015 08:40:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zf5oq-00040n-CC for help-gnu-emacs@gnu.org; Thu, 24 Sep 2015 08:40:13 -0400 Original-Received: from mail-io0-x22f.google.com ([2607:f8b0:4001:c06::22f]:34990) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf5oq-00040j-6L for help-gnu-emacs@gnu.org; Thu, 24 Sep 2015 08:40:12 -0400 Original-Received: by ioiz6 with SMTP id z6so74515046ioi.2 for ; Thu, 24 Sep 2015 05:40:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=6px3rpCA+Vi9jjWBOwmKftQ0YlP9xWVpata0QI3R8sE=; b=j5W4STsh68W6yLPNheasSO2fb1Ouo1/piH3+1psPcCZ8AqrdN+G3t4uvTdILH80B4W YG5NGIMB5B8ncPFAVeou0aE6Az7uMFRGTZY5lZoA6irgsmP4YWFCAB5Ko6EIjir6RVGc 33SGt2hzK5P3ABY40wP1UrtR5p6Epfs8Tt9SBnRrRXNTQhL2EwJtfG8/lwdFvrBohwfn tS1o6QHgwx7AVJuYkS5us9lfI2rplWC7tfNdqn9QlPddVpWDnc83iLngZfHG0FBwJINy 971gSaMePBWuFA2blTlCg1XLgIbZmxEIuEIcPlscmHdE22ZVl8SptlmWCg+f2A4QsjPz FsQA== X-Received: by 10.107.3.168 with SMTP id e40mr137331ioi.151.1443098411194; Thu, 24 Sep 2015 05:40:11 -0700 (PDT) Original-Received: by 10.107.58.137 with HTTP; Thu, 24 Sep 2015 05:39:51 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4001:c06::22f X-Mailman-Approved-At: Thu, 24 Sep 2015 09:18:07 -0400 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:107313 Archived-At: 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