changeset 31747:cc2e3eead63c

(with-auto-compression-mode): New macro.
author Miles Bader <miles@gnu.org>
date Wed, 20 Sep 2000 04:43:26 +0000
parents 0436ca82bab2
children 6d580942d64b
files lisp/jka-compr.el
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/jka-compr.el	Wed Sep 20 02:07:56 2000 +0000
+++ b/lisp/jka-compr.el	Wed Sep 20 04:43:26 2000 +0000
@@ -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 @@
 
     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
    "\\("