1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 04:10:54 -08:00

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'.
This commit is contained in:
Lars Ingebrigtsen 2021-07-13 23:48:04 +02:00
parent 210b10f3fe
commit a5d1bd6a6d

View file

@ -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