aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2021-07-13 23:48:04 +0200
committerLars Ingebrigtsen2021-07-13 23:48:04 +0200
commita5d1bd6a6d9cd4b8c832e9dcecb1b908ae973fa9 (patch)
tree5e0b6856680614fd1a9996d809876b6e7a1d3aab
parent210b10f3fe7d2b847f7af31276c05001c8fc0ed7 (diff)
downloademacs-a5d1bd6a6d9cd4b8c832e9dcecb1b908ae973fa9.tar.gz
emacs-a5d1bd6a6d9cd4b8c832e9dcecb1b908ae973fa9.zip
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'.
-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 `/'."
415 (fboundp uncompress-function)) 415 (fboundp uncompress-function))
416 ;; If we don't have the uncompression program, then use the 416 ;; If we don't have the uncompression program, then use the
417 ;; internal uncompression function (if we have one). 417 ;; internal uncompression function (if we have one).
418 (progn 418 (let ((buf (current-buffer)))
419 (insert 419 (with-temp-buffer
420 (with-temp-buffer 420 (set-buffer-multibyte nil)
421 (set-buffer-multibyte nil) 421 (insert-file-contents-literally file)
422 (insert-file-contents-literally file) 422 (funcall uncompress-function (point-min) (point-max))
423 (funcall uncompress-function (point-min) (point-max)) 423 (when end
424 (when end 424 (delete-region end (point-max)))
425 (delete-region end (point-max))) 425 (when beg
426 (when beg 426 (delete-region (point-min) beg))
427 (delete-region (point-min) beg)) 427 (setq size (buffer-size))
428 (setq size (buffer-size)) 428 (insert-into-buffer buf))
429 (buffer-string)))
430 (goto-char (point-min))) 429 (goto-char (point-min)))
431 ;; Use the external uncompression program. 430 ;; Use the external uncompression program.
432 (condition-case error-code 431 (condition-case error-code