emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/src ChangeLog buffer.c buffer.h fileio.c


From: Richard M. Stallman
Subject: [Emacs-diffs] emacs/src ChangeLog buffer.c buffer.h fileio.c
Date: Thu, 16 Jul 2009 01:45:12 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Richard M. Stallman <rms>       09/07/16 01:45:12

Modified files:
        src            : ChangeLog buffer.c buffer.h fileio.c 

Log message:
        * fileio.c (Fwrite_region, Fdo_auto_save): Handle save_length = -2.
        (Fset_buffer_auto_saved): Handle save_length = -2.
        
        Comment changes in other files.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/src/ChangeLog?cvsroot=emacs&r1=1.7650&r2=1.7651
http://cvs.savannah.gnu.org/viewcvs/emacs/src/buffer.c?cvsroot=emacs&r1=1.582&r2=1.583
http://cvs.savannah.gnu.org/viewcvs/emacs/src/buffer.h?cvsroot=emacs&r1=1.126&r2=1.127
http://cvs.savannah.gnu.org/viewcvs/emacs/src/fileio.c?cvsroot=emacs&r1=1.655&r2=1.656

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/src/ChangeLog,v
retrieving revision 1.7650
retrieving revision 1.7651
diff -u -b -r1.7650 -r1.7651
--- ChangeLog   16 Jul 2009 01:24:00 -0000      1.7650
+++ ChangeLog   16 Jul 2009 01:45:08 -0000      1.7651
@@ -1,3 +1,8 @@
+2009-07-16  Richard Stallman  <address@hidden>
+
+       * fileio.c (Fwrite_region, Fdo_auto_save): Handle save_length = -2.
+       (Fset_buffer_auto_saved): Handle save_length = -2.
+
 2009-07-16  Chong Yidong  <address@hidden>
 
        * xterm.c (Qx_gtk_map_stock): New var.

Index: buffer.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/buffer.c,v
retrieving revision 1.582
retrieving revision 1.583
diff -u -b -r1.582 -r1.583
--- buffer.c    14 Apr 2009 13:57:12 -0000      1.582
+++ buffer.c    16 Jul 2009 01:45:11 -0000      1.583
@@ -5853,7 +5853,12 @@
   DEFVAR_PER_BUFFER ("buffer-saved-size", &current_buffer->save_length,
                     make_number (Lisp_Int),
                     doc: /* Length of current buffer when last read in, saved 
or auto-saved.
-0 initially.  */);
+0 initially.
+-1 means auto-saving turned off until next real save.
+
+If you set this to -2, that means don't turn off auto-saving in this buffer
+if its text size shrinks.   If you use `buffer-swap-text' on a buffer,
+you probably should set this to -2 in that buffer.  */);
 
   DEFVAR_PER_BUFFER ("selective-display", &current_buffer->selective_display,
                     Qnil,

Index: buffer.h
===================================================================
RCS file: /cvsroot/emacs/emacs/src/buffer.h,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -b -r1.126 -r1.127
--- buffer.h    8 Jan 2009 03:15:25 -0000       1.126
+++ buffer.h    16 Jul 2009 01:45:11 -0000      1.127
@@ -584,6 +584,9 @@
   /* This isn't really used by the C code, so could be deleted.  */
   Lisp_Object backed_up;
   /* Length of file when last read or saved.
+     -1 means auto saving turned off because buffer shrank a lot.
+     -2 means don't turn off auto saving if buffer shrinks.
+       (That value is used with buffer-swap-text.)
      This is not in the  struct buffer_text
      because it's not used in indirect buffers at all.  */
   Lisp_Object save_length;

Index: fileio.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/fileio.c,v
retrieving revision 1.655
retrieving revision 1.656
diff -u -b -r1.655 -r1.656
--- fileio.c    7 Jul 2009 22:52:59 -0000       1.655
+++ fileio.c    16 Jul 2009 01:45:11 -0000      1.656
@@ -4492,6 +4492,7 @@
       if (visiting)
        {
          SAVE_MODIFF = MODIFF;
+         if (XINT (current_buffer->save_length) != -2)
          XSETFASTINT (current_buffer->save_length, Z - BEG);
          current_buffer->filename = visit_file;
        }
@@ -4703,6 +4704,7 @@
   if (visiting)
     {
       SAVE_MODIFF = MODIFF;
+      if (XINT (current_buffer->save_length) != -2)
       XSETFASTINT (current_buffer->save_length, Z - BEG);
       current_buffer->filename = visit_file;
       update_mode_lines++;
@@ -5307,7 +5309,7 @@
            && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)
            && b->auto_save_modified < BUF_MODIFF (b)
            /* -1 means we've turned off autosaving for a while--see below.  */
-           && XINT (b->save_length) >= 0
+           && XINT (b->save_length) != -1
            && (do_handled_files
                || NILP (Ffind_file_name_handler (b->auto_save_file_name,
                                                  Qwrite_region))))
@@ -5321,7 +5323,9 @@
                && EMACS_SECS (before_time) - b->auto_save_failure_time < 1200)
              continue;
 
-           if ((XFASTINT (b->save_length) * 10
+           if (XINT (b->save_length) != -2
+               /* -2 is a magic flag turning off this feature in a buffer.  */
+               && (XFASTINT (b->save_length) * 10
                 > (BUF_Z (b) - BUF_BEG (b)) * 13)
                /* A short file is likely to change a large fraction;
                   spare the user annoying messages.  */
@@ -5347,6 +5351,7 @@
            internal_condition_case (auto_save_1, Qt, auto_save_error);
            auto_saved++;
            b->auto_save_modified = BUF_MODIFF (b);
+           if (XINT (current_buffer->save_length) != -2)
            XSETFASTINT (current_buffer->save_length, Z - BEG);
            set_buffer_internal (old);
 
@@ -5392,6 +5397,7 @@
      ()
 {
   current_buffer->auto_save_modified = MODIFF;
+  if (XINT (current_buffer->save_length) != -2)
   XSETFASTINT (current_buffer->save_length, Z - BEG);
   current_buffer->auto_save_failure_time = -1;
   return Qnil;




reply via email to

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