summaryrefslogtreecommitdiff
path: root/lisp/jka-compr.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2008-05-28 17:35:34 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2008-05-28 17:35:34 +0000
commitab1d38354db0b8c9028347f4c532d546f3d928d8 (patch)
treedf884efd8aac4c0eb14d30f8e79db80039f4125d /lisp/jka-compr.el
parenta6e0b7e57248adf3ce9615f8de08dac2ff46f6ee (diff)
downloademacs-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.
Diffstat (limited to 'lisp/jka-compr.el')
-rw-r--r--lisp/jka-compr.el15
1 files changed, 6 insertions, 9 deletions
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))