emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/src/fileio.c


From: Richard M . Stallman
Subject: [Emacs-diffs] Changes to emacs/src/fileio.c
Date: Fri, 13 May 2005 09:33:54 -0400

Index: emacs/src/fileio.c
diff -c emacs/src/fileio.c:1.540 emacs/src/fileio.c:1.541
*** emacs/src/fileio.c:1.540    Sun May  8 23:40:34 2005
--- emacs/src/fileio.c  Fri May 13 13:33:53 2005
***************
*** 373,379 ****
          Lisp_Object string = XCAR (elt);
          int match_pos;
          Lisp_Object handler = XCDR (elt);
!         Lisp_Object operations = Fget (handler, Qoperations);
  
          if (STRINGP (string)
              && (match_pos = fast_string_match (string, filename)) > pos
--- 373,382 ----
          Lisp_Object string = XCAR (elt);
          int match_pos;
          Lisp_Object handler = XCDR (elt);
!         Lisp_Object operations = Qnil;
! 
!         if (SYMBOLP (handler))
!           operations = Fget (handler, Qoperations);
  
          if (STRINGP (string)
              && (match_pos = fast_string_match (string, filename)) > pos
***************
*** 2862,2868 ****
  #ifdef S_IFLNK
  DEFUN ("make-symbolic-link", Fmake_symbolic_link, Smake_symbolic_link, 2, 3,
         "FMake symbolic link to file: \nGMake symbolic link to file %s: \np",
!        doc: /* Make a symbolic link to FILENAME, named LINKNAME.  Both args 
must be strings.
  Signals a `file-already-exists' error if a file LINKNAME already exists
  unless optional third argument OK-IF-ALREADY-EXISTS is non-nil.
  A number as third arg means request confirmation if LINKNAME already exists.
--- 2865,2872 ----
  #ifdef S_IFLNK
  DEFUN ("make-symbolic-link", Fmake_symbolic_link, Smake_symbolic_link, 2, 3,
         "FMake symbolic link to file: \nGMake symbolic link to file %s: \np",
!        doc: /* Make a symbolic link to FILENAME, named LINKNAME.
! Both args must be strings.
  Signals a `file-already-exists' error if a file LINKNAME already exists
  unless optional third argument OK-IF-ALREADY-EXISTS is non-nil.
  A number as third arg means request confirmation if LINKNAME already exists.
***************
*** 3060,3067 ****
  }
  
  DEFUN ("file-exists-p", Ffile_exists_p, Sfile_exists_p, 1, 1, 0,
!        doc: /* Return t if file FILENAME exists.  (This does not mean you can 
read it.)
! See also `file-readable-p' and `file-attributes'.  */)
       (filename)
       Lisp_Object filename;
  {
--- 3064,3073 ----
  }
  
  DEFUN ("file-exists-p", Ffile_exists_p, Sfile_exists_p, 1, 1, 0,
!        doc: /* Return t if file FILENAME exists (whether or not you can read 
it.)
! See also `file-readable-p' and `file-attributes'.
! This returns nil for a symlink to a nonexistent file.
! Use `file-symlink-p' to test for such links.  */)
       (filename)
       Lisp_Object filename;
  {
***************
*** 3238,3244 ****
  DEFUN ("file-symlink-p", Ffile_symlink_p, Sfile_symlink_p, 1, 1, 0,
         doc: /* Return non-nil if file FILENAME is the name of a symbolic link.
  The value is the link target, as a string.
! Otherwise returns nil.  */)
       (filename)
       Lisp_Object filename;
  {
--- 3244,3253 ----
  DEFUN ("file-symlink-p", Ffile_symlink_p, Sfile_symlink_p, 1, 1, 0,
         doc: /* Return non-nil if file FILENAME is the name of a symbolic link.
  The value is the link target, as a string.
! Otherwise it returns nil.
! 
! This function returns t when given the name of a symlink that
! points to a nonexistent file.  */)
       (filename)
       Lisp_Object filename;
  {
***************
*** 3728,3733 ****
--- 3737,3744 ----
    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)
--- 4411,4427 ----
      /* 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 ****
--- 4511,4526 ----
        }
    }
  
+   /* 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;
***************
*** 6036,6042 ****
  
  DEFUN ("recent-auto-save-p", Frecent_auto_save_p, Srecent_auto_save_p,
         0, 0, 0,
!        doc: /* Return t if current buffer has been auto-saved since last read 
in or saved.  */)
       ()
  {
    return (SAVE_MODIFF < current_buffer->auto_save_modified) ? Qt : Qnil;
--- 6066,6075 ----
  
  DEFUN ("recent-auto-save-p", Frecent_auto_save_p, Srecent_auto_save_p,
         0, 0, 0,
!        doc: /* Return t if current buffer has been auto-saved recently.
! More precisely, if it has been auto-saved since last read from or saved
! in the visited file.  If the buffer has no visited file,
! then any auto-save counts as "recent".  */)
       ()
  {
    return (SAVE_MODIFF < current_buffer->auto_save_modified) ? Qt : Qnil;




reply via email to

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