From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Richard M. Stallman" Newsgroups: gmane.emacs.devel Subject: Re: A few questions about desktop.el Date: Wed, 27 Jul 2005 23:20:46 -0400 Message-ID: References: Reply-To: rms@gnu.org NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1122521731 2423 80.91.229.2 (28 Jul 2005 03:35:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 28 Jul 2005 03:35:31 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 28 05:35:31 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DxzB4-00005w-EQ for ged-emacs-devel@m.gmane.org; Thu, 28 Jul 2005 05:35:22 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DxzDU-0001d2-G2 for ged-emacs-devel@m.gmane.org; Wed, 27 Jul 2005 23:37:52 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DxzB5-0001KK-JR for emacs-devel@gnu.org; Wed, 27 Jul 2005 23:35:24 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DxzAl-0001CW-Ts for emacs-devel@gnu.org; Wed, 27 Jul 2005 23:35:05 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DxzAl-0001AB-Nr for emacs-devel@gnu.org; Wed, 27 Jul 2005 23:35:03 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Dxz8j-00032C-O0 for emacs-devel@gnu.org; Wed, 27 Jul 2005 23:32:57 -0400 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.34) id 1Dxyww-0008RY-Bh; Wed, 27 Jul 2005 23:20:46 -0400 Original-To: Juanma Barranquero In-reply-to: (message from Juanma Barranquero on Wed, 27 Jul 2005 16:28:17 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:41253 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:41253 It'd be very useful to try to detect it and at least stop the second instance from loading and using the desktop file if it's already in use. There's no way to do that from Emacs, is there? It needs to use file-locking together with testing of the file modtime. There are primitives to do this: lock-file and unlock-file, and file-attributes. So when you restore an old desktop, you record the modtime of the file. When you update the desktop file, you lock it, them see if its modtime is the same as it was when you restored the desktop. If not, you do whatever.