summaryrefslogtreecommitdiff
path: root/lisp/jka-compr.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-07-13 23:48:04 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2021-07-13 23:48:04 +0200
commita5d1bd6a6d9cd4b8c832e9dcecb1b908ae973fa9 (patch)
tree5e0b6856680614fd1a9996d809876b6e7a1d3aab /lisp/jka-compr.el
parent210b10f3fe7d2b847f7af31276c05001c8fc0ed7 (diff)
downloademacs-a5d1bd6a6d9cd4b8c832e9dcecb1b908ae973fa9.tar.gz
Make jka-compr-insert-file-contents slightly more efficient
* lisp/jka-compr.el (jka-compr-insert-file-contents): Make more efficient by using `insert-into-buffer'.
Diffstat (limited to 'lisp/jka-compr.el')
-rw-r--r--lisp/jka-compr.el23
1 files changed, 11 insertions, 12 deletions
diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el
index 692b6b4adfb..658ea44a348 100644
--- a/lisp/jka-compr.el
+++ b/lisp/jka-compr.el
@@ -415,18 +415,17 @@ There should be no more than seven characters after the final `/'."
(fboundp uncompress-function))
;; If we don't have the uncompression program, then use the
;; internal uncompression function (if we have one).
- (progn
- (insert
- (with-temp-buffer
- (set-buffer-multibyte nil)
- (insert-file-contents-literally file)
- (funcall uncompress-function (point-min) (point-max))
- (when end
- (delete-region end (point-max)))
- (when beg
- (delete-region (point-min) beg))
- (setq size (buffer-size))
- (buffer-string)))
+ (let ((buf (current-buffer)))
+ (with-temp-buffer
+ (set-buffer-multibyte nil)
+ (insert-file-contents-literally file)
+ (funcall uncompress-function (point-min) (point-max))
+ (when end
+ (delete-region end (point-max)))
+ (when beg
+ (delete-region (point-min) beg))
+ (setq size (buffer-size))
+ (insert-into-buffer buf))
(goto-char (point-min)))
;; Use the external uncompression program.
(condition-case error-code