From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Evil Boris Newsgroups: gmane.emacs.devel Subject: Re: RMAIL file locking problem? Date: Wed, 11 May 2005 20:32:34 -0400 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1115857628 18805 80.91.229.2 (12 May 2005 00:27:08 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 12 May 2005 00:27:08 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 12 02:27:06 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DW1XJ-000782-4L for ged-emacs-devel@m.gmane.org; Thu, 12 May 2005 02:26:45 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DW1g8-0003Jn-Ve for ged-emacs-devel@m.gmane.org; Wed, 11 May 2005 20:35:53 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DW1ft-0003Hm-IB for emacs-devel@gnu.org; Wed, 11 May 2005 20:35:37 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DW1fs-0003HW-VM for emacs-devel@gnu.org; Wed, 11 May 2005 20:35:37 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DW1fs-0003Gh-Ce for emacs-devel@gnu.org; Wed, 11 May 2005 20:35:36 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1DW1k7-0003MB-8c for emacs-devel@gnu.org; Wed, 11 May 2005 20:39:59 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1DW1Vk-00071K-98 for emacs-devel@gnu.org; Thu, 12 May 2005 02:25:08 +0200 Original-Received: from 207-38-193-43.c3-0.wsd-ubr1.qens-wsd.ny.cable.rcn.com ([207.38.193.43]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 12 May 2005 02:25:08 +0200 Original-Received: from evilborisnet by 207-38-193-43.c3-0.wsd-ubr1.qens-wsd.ny.cable.rcn.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 12 May 2005 02:25:08 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 31 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 207-38-193-43.c3-0.wsd-ubr1.qens-wsd.ny.cable.rcn.com User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (windows-nt) Cancel-Lock: sha1:kmpW0yD+6z3yn5C6yxl/ls9gTKA= 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:37003 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:37003 Richard Stallman writes: > I think I have fixed this; does this give good results? > > [...] > > + /* Now we have read all the file data into the gap. > + If it was empty, undo marking the buffer modified. */ > + > + if (inserted == 0) > + { > + if (we_locked_file) > + unlock_file (current_buffer->file_truename); > + Vdeactivate_mark = old_Vdeactivate_mark; > + } > + > /* Make the text read part of the buffer. */ I will try it shortly. I have one concern though---does this code take care of the situation when the buffer was modified even before insert-file-contents is called? I do not understand the details of the code, but I am worried that if you read in 0 bytes into an already-modified buffer, you might remove a lock that was there initially for reasons unrelated to the insert-file-contents. I wonder if one should use the functionality equivalent to file-locked-p to test for this. Perhaps you are already doing it, as I do not understand the "#ifdef CLASH_DETECTION" surrounded code. --Boris