comparison lisp/files.el @ 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 edfe642dc91c
children 52e3cee99f90
comparison
equal deleted inserted replaced
95361:86492fb49824 95362:e886c765584a
4083 (while (condition-case () 4083 (while (condition-case ()
4084 (progn 4084 (progn
4085 (setq tempname 4085 (setq tempname
4086 (make-temp-name 4086 (make-temp-name
4087 (expand-file-name "tmp" dir))) 4087 (expand-file-name "tmp" dir)))
4088 (write-region (point-min) (point-max) 4088 ;; Pass in nil&nil rather than point-min&max
4089 ;; cause we're saving the whole buffer.
4090 ;; write-region-annotate-functions may use it.
4091 (write-region nil nil
4089 tempname nil realname 4092 tempname nil realname
4090 buffer-file-truename 'excl) 4093 buffer-file-truename 'excl)
4091 nil) 4094 nil)
4092 (file-already-exists t)) 4095 (file-already-exists t))
4093 ;; The file was somehow created by someone else between 4096 ;; The file was somehow created by someone else between
4117 (setq setmodes (cons (file-modes buffer-file-name) buffer-file-name)) 4120 (setq setmodes (cons (file-modes buffer-file-name) buffer-file-name))
4118 (set-file-modes buffer-file-name (logior (car setmodes) 128)))) 4121 (set-file-modes buffer-file-name (logior (car setmodes) 128))))
4119 (let (success) 4122 (let (success)
4120 (unwind-protect 4123 (unwind-protect
4121 (progn 4124 (progn
4122 (write-region (point-min) (point-max) 4125 ;; Pass in nil&nil rather than point-min&max to indicate
4126 ;; we're saving the buffer rather than just a region.
4127 ;; write-region-annotate-functions may make us of it.
4128 (write-region nil nil
4123 buffer-file-name nil t buffer-file-truename) 4129 buffer-file-name nil t buffer-file-truename)
4124 (setq success t)) 4130 (setq success t))
4125 ;; If we get an error writing the new file, and we made 4131 ;; If we get an error writing the new file, and we made
4126 ;; the backup by renaming, undo the backing-up. 4132 ;; the backup by renaming, undo the backing-up.
4127 (and setmodes (not success) 4133 (and setmodes (not success)