emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master a5d1bd6 3/3: Make jka-compr-insert-file-contents slightly more ef


From: Lars Ingebrigtsen
Subject: master a5d1bd6 3/3: Make jka-compr-insert-file-contents slightly more efficient
Date: Tue, 13 Jul 2021 17:48:14 -0400 (EDT)

branch: master
commit a5d1bd6a6d9cd4b8c832e9dcecb1b908ae973fa9
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    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'.
---
 lisp/jka-compr.el | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el
index 692b6b4..658ea44 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]