Commit ab1d3835 authored by Stefan Monnier's avatar Stefan Monnier

* progmodes/flymake.el (flymake-save-buffer-in-file):

* shadowfile.el (shadow-copy-file):
* arc-mode.el (archive-*-write-file-member):
* files.el (diff-buffer-with-file):
* subr.el (with-temp-file): Pass nil to write-region.
* jka-compr.el (jka-compr-write-region): Preserve `start's nullness.
parent a6e0b7e5
2008-05-28 Stefan Monnier <monnier@iro.umontreal.ca>
* progmodes/flymake.el (flymake-save-buffer-in-file):
* shadowfile.el (shadow-copy-file):
* arc-mode.el (archive-*-write-file-member):
* files.el (diff-buffer-with-file):
* subr.el (with-temp-file): Pass nil to write-region.
* jka-compr.el (jka-compr-write-region): Preserve `start's nullness.
* doc-view.el (doc-view-mode-map): Bind `q' to quit-window, as is
the custom.
......
......@@ -1171,7 +1171,7 @@ using `make-temp-file', and the generated name is returned."
;; the dired-like listing we created.
(if (eq major-mode 'archive-mode)
(archive-write-file tmpfile)
(write-region (point-min) (point-max) tmpfile nil 'nomessage))
(write-region nil nil tmpfile nil 'nomessage))
;; basic-save-buffer needs last-coding-system-used to have
;; the value used to write the file, so save it before any
;; further processing clobbers it (we restore it in
......
......@@ -2715,7 +2715,7 @@ only if this merge job is part of a group, i.e., was invoked from within
(if (or (not (file-exists-p file))
(y-or-n-p (format "File %s exists, overwrite? " file)))
(progn
;;(write-region (point-min) (point-max) file)
;;(write-region nil nil file)
(ediff-with-current-buffer buf
(set-visited-file-name file)
(save-buffer))
......
......@@ -4145,9 +4145,8 @@ This requires the external program `diff' to be in your `exec-path'."
(file-exists-p buffer-file-name))
(let ((tempfile (make-temp-file "buffer-content-")))
(unwind-protect
(save-restriction
(widen)
(write-region (point-min) (point-max) tempfile nil 'nomessage)
(progn
(write-region nil nil tempfile nil 'nomessage)
(diff buffer-file-name tempfile nil t)
(sit-for 0))
(when (file-exists-p tempfile)
......
......@@ -257,16 +257,12 @@ There should be no more than seven characters after the final `/'."
(info (jka-compr-get-compression-info visit-file))
(magic (and info (jka-compr-info-file-magic-bytes info))))
;; If START is nil, use the whole buffer.
(if (null start)
(setq start 1 end (1+ (buffer-size))))
;; If we uncompressed this file when visiting it,
;; then recompress it when writing it
;; even if the contents look compressed already.
(if (and jka-compr-really-do-compress
(eq start 1)
(eq end (1+ (buffer-size))))
(or (null start)
(= (- end start) (buffer-size))))
(setq magic nil))
(if (and info
......@@ -277,9 +273,10 @@ There should be no more than seven characters after the final `/'."
(equal (if (stringp start)
(substring start 0 (min (length start)
(length magic)))
(buffer-substring start
(min end
(+ start (length magic)))))
(let ((from (or start (point-min)))
(to (min (or end (point-max))
(+ from (length magic)))))
(buffer-substring from to)))
magic))))
(let ((can-append (jka-compr-info-can-append info))
(compress-program (jka-compr-info-compress-program info))
......
......@@ -562,10 +562,8 @@ Find master file, patch and save it."
nil))))
(defun flymake-save-buffer-in-file (file-name)
(save-restriction
(widen)
(make-directory (file-name-directory file-name) 1)
(write-region (point-min) (point-max) file-name nil 566))
(make-directory (file-name-directory file-name) 1)
(write-region nil nil file-name nil 566)
(flymake-log 3 "saved buffer %s in file %s" (buffer-name) file-name))
(defun flymake-save-string-to-file (file-name data)
......
......@@ -573,13 +573,11 @@ site."
(to (shadow-expand-cluster-in-file-name (cdr s))))
(when buffer
(set-buffer buffer)
(save-restriction
(widen)
(condition-case i
(progn
(write-region (point-min) (point-max) to)
(shadow-remove-from-todo s))
(error (message "Shadow %s not updated!" (cdr s))))))))
(condition-case i
(progn
(write-region nil nil to)
(shadow-remove-from-todo s))
(error (message "Shadow %s not updated!" (cdr s)))))))
(defun shadow-shadows-of (file)
"Return copy operations needed to update FILE.
......
......@@ -2562,8 +2562,7 @@ See also `with-temp-buffer'."
(with-current-buffer ,temp-buffer
,@body)
(with-current-buffer ,temp-buffer
(widen)
(write-region (point-min) (point-max) ,temp-file nil 0)))
(write-region nil nil ,temp-file nil 0)))
(and (buffer-name ,temp-buffer)
(kill-buffer ,temp-buffer))))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment