emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RMAIL file locking problem?


From: Richard Stallman
Subject: Re: RMAIL file locking problem?
Date: Wed, 11 May 2005 12:28:59 -0400

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;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]