diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2008-05-28 17:35:34 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2008-05-28 17:35:34 +0000 |
commit | ab1d38354db0b8c9028347f4c532d546f3d928d8 (patch) | |
tree | df884efd8aac4c0eb14d30f8e79db80039f4125d | |
parent | a6e0b7e57248adf3ce9615f8de08dac2ff46f6ee (diff) | |
download | emacs-ab1d38354db0b8c9028347f4c532d546f3d928d8.tar.gz |
* 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.
-rw-r--r-- | lisp/ChangeLog | 7 | ||||
-rw-r--r-- | lisp/arc-mode.el | 2 | ||||
-rw-r--r-- | lisp/ediff-util.el | 2 | ||||
-rw-r--r-- | lisp/files.el | 5 | ||||
-rw-r--r-- | lisp/jka-compr.el | 15 | ||||
-rw-r--r-- | lisp/progmodes/flymake.el | 6 | ||||
-rw-r--r-- | lisp/shadowfile.el | 12 | ||||
-rw-r--r-- | lisp/subr.el | 3 |
8 files changed, 25 insertions, 27 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6a395dcb2ab..b3e2660c5e4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,12 @@ 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. diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index 8070e95a671..1f54b32cc06 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el @@ -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 diff --git a/lisp/ediff-util.el b/lisp/ediff-util.el index 2622d461bf5..9aef531b39a 100644 --- a/lisp/ediff-util.el +++ b/lisp/ediff-util.el @@ -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)) diff --git a/lisp/files.el b/lisp/files.el index 14752752b79..0fcbcb2a397 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -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) diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el index ada7606fc44..a5792ed25b5 100644 --- a/lisp/jka-compr.el +++ b/lisp/jka-compr.el @@ -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)) diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 5412e2b3be5..c6c58ef76dc 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -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) diff --git a/lisp/shadowfile.el b/lisp/shadowfile.el index 29eb04e7c32..5481bbaf2b0 100644 --- a/lisp/shadowfile.el +++ b/lisp/shadowfile.el @@ -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. diff --git a/lisp/subr.el b/lisp/subr.el index 8264055651a..10edc540501 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -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)))))) |