changeset 95362:e886c765584a

* src/fileio.c (Fwrite_region): Delay the defaulting to beg&z to after calling build_annotations. * lisp/files.el (basic-save-buffer-2): Pass nil rather than (point-min) to write-region.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 28 May 2008 12:36:15 +0000
parents 86492fb49824
children 3c5bdcf6184e
files lisp/ChangeLog lisp/files.el src/ChangeLog src/fileio.c
diffstat 4 files changed, 28 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed May 28 12:26:41 2008 +0000
+++ b/lisp/ChangeLog	Wed May 28 12:36:15 2008 +0000
@@ -1,3 +1,8 @@
+2008-05-28  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* files.el (basic-save-buffer-2): Pass nil rather than (point-min)
+	to write-region.
+
 2008-05-28  Glenn Morris  <rgm@gnu.org>
 
 	* Makefile.in (update-elclist): Work around non-portability of "\"
--- a/lisp/files.el	Wed May 28 12:26:41 2008 +0000
+++ b/lisp/files.el	Wed May 28 12:36:15 2008 +0000
@@ -4085,7 +4085,10 @@
 			       (setq tempname
 				     (make-temp-name
 				      (expand-file-name "tmp" dir)))
-			       (write-region (point-min) (point-max)
+                               ;; Pass in nil&nil rather than point-min&max
+                               ;; cause we're saving the whole buffer.
+                               ;; write-region-annotate-functions may use it.
+			       (write-region nil nil
 					     tempname nil  realname
 					     buffer-file-truename 'excl)
 			       nil)
@@ -4119,7 +4122,10 @@
 	(let (success)
 	  (unwind-protect
 	      (progn
-		(write-region (point-min) (point-max)
+                ;; Pass in nil&nil rather than point-min&max to indicate
+                ;; we're saving the buffer rather than just a region.
+                ;; write-region-annotate-functions may make us of it.
+		(write-region nil nil
 			      buffer-file-name nil t buffer-file-truename)
 		(setq success t))
 	    ;; If we get an error writing the new file, and we made
--- a/src/ChangeLog	Wed May 28 12:26:41 2008 +0000
+++ b/src/ChangeLog	Wed May 28 12:36:15 2008 +0000
@@ -1,3 +1,8 @@
+2008-05-28  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* fileio.c (Fwrite_region): Delay the defaulting to beg&z to after
+	calling build_annotations.
+
 2008-05-28  Juanma Barranquero  <lekktu@gmail.com>
 
 	* coding.c (Fdecode_coding_region, Fencode_coding_region)
--- a/src/fileio.c	Wed May 28 12:26:41 2008 +0000
+++ b/src/fileio.c	Wed May 28 12:36:15 2008 +0000
@@ -5079,8 +5079,11 @@
   /* Special kludge to simplify auto-saving.  */
   if (NILP (start))
     {
+      /* Do it later, so write-region-annotate-function can work differently
+	 if we save "the buffer" vs "a region".
+	 This is useful in tar-mode.  --Stef
       XSETFASTINT (start, BEG);
-      XSETFASTINT (end, Z);
+      XSETFASTINT (end, Z); */
       Fwiden ();
     }
 
@@ -5100,6 +5103,12 @@
 	}
     }
 
+  if (NILP (start))
+    {
+      XSETFASTINT (start, BEGV);
+      XSETFASTINT (end, ZV);
+    }
+
   UNGCPRO;
 
   GCPRO5 (start, filename, annotations, visit_file, lockname);