]> git.eshelyaron.com Git - emacs.git/commitdiff
Add suffixes individually and use minor mode directly
authorMichael R. Mauger <michael@mauger.com>
Wed, 16 Oct 2024 21:59:58 +0000 (17:59 -0400)
committerEshel Yaron <me@eshelyaron.com>
Thu, 17 Oct 2024 18:51:13 +0000 (20:51 +0200)
  * lisp/jka-cmpr-hook.el (jka-compr-install): Add jka-compr
  suffixes individually with add-to-list rather than append.
  * (with-auto-compression-mode): Use auto-compression-mode minor mode.

(cherry picked from commit aaa734ac6e80e3375bcf32cad9c2b484c1217b57)

lisp/jka-cmpr-hook.el

index ced998fafb64220cead33422967b9754f5e30561..7e502f02b3c9322ee10ca510f6dd7bc7e0117b2b 100644 (file)
@@ -160,8 +160,8 @@ and `inhibit-local-variables-suffixes'."
        (append auto-mode-alist jka-compr-mode-alist-additions))
 
   ;; Make sure that (load "foo") will find /bla/foo.el.gz.
-  (setq load-file-rep-suffixes
-       (append load-file-rep-suffixes jka-compr-load-suffixes nil)))
+  (dolist (suff jka-compr-load-suffixes load-file-rep-suffixes)
+    (add-to-list 'load-file-rep-suffixes suff t)))
 
 (defun jka-compr-installed-p ()
   "Return non-nil if jka-compr is installed.
@@ -379,14 +379,14 @@ compressed when writing."
   "Evaluate BODY with automatic file compression and uncompression enabled."
   (declare (indent 0))
   (let ((already-installed (make-symbol "already-installed")))
-    `(let ((,already-installed (jka-compr-installed-p)))
+    `(let ((,already-installed auto-compression-mode))
        (unwind-protect
           (progn
             (unless ,already-installed
-              (jka-compr-install))
+              (auto-compression-mode 1))
             ,@body)
         (unless ,already-installed
-          (jka-compr-uninstall))))))
+          (auto-compression-mode -1))))))
 
 ;; This is what we need to know about jka-compr-handler
 ;; in order to decide when to call it.