Mercurial > emacs
diff lisp/jka-compr.el @ 95366:52e3cee99f90
* 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.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 28 May 2008 17:35:34 +0000 |
parents | ee5932bf781d |
children | f77d335546ac |
line wrap: on
line diff
--- a/lisp/jka-compr.el Wed May 28 16:13:20 2008 +0000 +++ b/lisp/jka-compr.el Wed May 28 17:35:34 2008 +0000 @@ -257,16 +257,12 @@ (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 @@ (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))