From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: RMAIL file locking problem? Date: Wed, 11 May 2005 12:28:59 -0400 Message-ID: References: Reply-To: rms@gnu.org NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1115829002 25917 80.91.229.2 (11 May 2005 16:30:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 11 May 2005 16:30:02 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 11 18:30:01 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DVu5A-0004sC-8R for ged-emacs-devel@m.gmane.org; Wed, 11 May 2005 18:29:12 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DVuDv-0002Li-Mw for ged-emacs-devel@m.gmane.org; Wed, 11 May 2005 12:38:15 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DVu9e-00073m-VD for emacs-devel@gnu.org; Wed, 11 May 2005 12:33:51 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DVu9b-00071O-Hd for emacs-devel@gnu.org; Wed, 11 May 2005 12:33:47 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DVu9b-0006zv-21 for emacs-devel@gnu.org; Wed, 11 May 2005 12:33:47 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DVuCW-0000U8-L6 for emacs-devel@gnu.org; Wed, 11 May 2005 12:36:48 -0400 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.34) id 1DVu4x-0003nz-8x; Wed, 11 May 2005 12:28:59 -0400 Original-To: Evil Boris In-reply-to: (message from Evil Boris on Mon, 09 May 2005 23:03:45 -0400) 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:36983 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:36983 I think I have fixed this; does this give good results? *** fileio.c 09 May 2005 16:51:43 -0400 1.540 --- fileio.c 11 May 2005 03:26:34 -0400 *** 3728,3733 **** --- 3732,3739 ---- int set_coding_system = 0; int coding_system_decided = 0; int read_quit = 0; + int old_Vdeactivate_mark = Vdeactivate_mark; + int we_locked_file = 0; if (current_buffer->base_buffer && ! NILP (visit)) error ("Cannot do file visiting in an indirect buffer"); *************** *** 4400,4407 **** /* For a special file, all we can do is guess. */ total = READ_BUF_SIZE; ! if (NILP (visit) && total > 0) ! prepare_to_modify_buffer (PT, PT, NULL); move_gap (PT); if (GAP_SIZE < total) --- 4406,4422 ---- /* For a special file, all we can do is guess. */ total = READ_BUF_SIZE; ! if (NILP (visit) && inserted > 0) ! { ! #ifdef CLASH_DETECTION ! if (!NILP (current_buffer->file_truename) ! /* Make binding buffer-file-name to nil effective. */ ! && !NILP (current_buffer->filename) ! && SAVE_MODIFF >= MODIFF) ! we_locked_file = 1; ! #endif /* CLASH_DETECTION */ ! prepare_to_modify_buffer (GPT, GPT, NULL); ! } move_gap (PT); if (GAP_SIZE < total) *************** *** 4491,4496 **** --- 4506,4521 ---- } } + /* 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. */ GAP_SIZE -= inserted; GPT += inserted;