From 6b3d752c5df6b19f6ff20174e3cb0471ff3daa27 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 28 May 2008 12:36:15 +0000 Subject: [PATCH] * 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. --- lisp/ChangeLog | 5 +++++ lisp/files.el | 10 ++++++++-- src/ChangeLog | 5 +++++ src/fileio.c | 11 ++++++++++- 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bf1a3e309fd..fc88bbc3c60 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2008-05-28 Stefan Monnier + + * files.el (basic-save-buffer-2): Pass nil rather than (point-min) + to write-region. + 2008-05-28 Glenn Morris * Makefile.in (update-elclist): Work around non-portability of "\" diff --git a/lisp/files.el b/lisp/files.el index 9802f903eeb..14752752b79 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -4085,7 +4085,10 @@ Before and after saving the buffer, this function runs (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 @@ Before and after saving the buffer, this function runs (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 diff --git a/src/ChangeLog b/src/ChangeLog index ef7acb97eb4..b4a3e74c453 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-05-28 Stefan Monnier + + * fileio.c (Fwrite_region): Delay the defaulting to beg&z to after + calling build_annotations. + 2008-05-28 Juanma Barranquero * coding.c (Fdecode_coding_region, Fencode_coding_region) diff --git a/src/fileio.c b/src/fileio.c index c4b0113523a..2a700a69f97 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -5079,8 +5079,11 @@ This does code conversion according to the value of /* 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 @@ This does code conversion according to the value of } } + if (NILP (start)) + { + XSETFASTINT (start, BEGV); + XSETFASTINT (end, ZV); + } + UNGCPRO; GCPRO5 (start, filename, annotations, visit_file, lockname); -- 2.39.2