]> git.eshelyaron.com Git - emacs.git/commitdiff
(with-auto-compression-mode): New macro.
authorMiles Bader <miles@gnu.org>
Wed, 20 Sep 2000 04:44:35 +0000 (04:44 +0000)
committerMiles Bader <miles@gnu.org>
Wed, 20 Sep 2000 04:44:35 +0000 (04:44 +0000)
lisp/ChangeLog
lisp/jka-compr.el

index 66845d062ac448db9225b2b9e4899281ef09e3ec..8b5a92b0d5606f0e8e88483e92b2a86a5debe744 100644 (file)
@@ -1,5 +1,7 @@
 2000-09-20  Miles Bader  <miles@lsi.nec.co.jp>
 
+       * jka-compr.el (with-auto-compression-mode): New macro.
+
        * cus-edit.el (custom-face-tag-face, custom-group-tag-face-1)
        (custom-group-tag-face, custom-variable-tag-face): Use relative
        :height and inherit from `variable-pitch' face instead of
index 7539ef9999cd36f78c60df33df41d376f86159a7..1d67272008ec6db011af2822943132bae01d71db 100644 (file)
@@ -1,6 +1,6 @@
 ;;; jka-compr.el --- reading/writing/loading compressed files
 
-;; Copyright (C) 1993, 1994, 1995, 1997, 1999  Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000  Free Software Foundation, Inc.
 
 ;; Author: jka@ece.cmu.edu (Jay K. Adams)
 ;; Maintainer: FSF
@@ -812,6 +812,21 @@ saying whether the mode is now on or off."
 
     flag))
 
+
+(defmacro with-auto-compression-mode (&rest body)
+  "Evalutes BODY with automatic file compression and uncompression enabled."
+  (let ((already-installed (make-symbol "already-installed")))
+    `(let ((,already-installed (jka-compr-installed-p)))
+       (unwind-protect
+          (progn
+            (unless ,already-installed
+              (jka-compr-install))
+            ,@body)
+        (unless ,already-installed
+          (jka-compr-uninstall))))))
+(put 'with-auto-compression-mode 'lisp-indent-function 0)
+
+
 (defun jka-compr-build-file-regexp ()
   (concat
    "\\("