# HG changeset patch # User Miles Bader # Date 970973821 0 # Node ID 44264092481b4c4eecaac6b47aacb6ef5df9a0ee # Parent c354d0540694f8d7b22734994e30153370136f6f (auto-compression-mode): Move to the end of the file, because `define-minor-mode' actually calls the mode-function if the associated variable is non-nil, which requires that all needed functions be already defined. (with-auto-compression-mode): Add autoload cookie. diff -r c354d0540694 -r 44264092481b lisp/jka-compr.el --- a/lisp/jka-compr.el Sun Oct 08 01:41:04 2000 +0000 +++ b/lisp/jka-compr.el Sun Oct 08 02:57:01 2000 +0000 @@ -755,34 +755,6 @@ (inhibit-file-name-operation operation)) (apply operation args))) -;;;###autoload -(define-minor-mode auto-compression-mode - "Toggle automatic file compression and uncompression. -With prefix argument ARG, turn auto compression on if positive, else off. -Returns the new status of auto compression (non-nil means on)." - nil nil nil :global t :group 'jka-compr - (let* ((installed (jka-compr-installed-p)) - (flag auto-compression-mode)) - (cond - ((and flag installed) t) ; already installed - ((and (not flag) (not installed)) nil) ; already not installed - (flag (jka-compr-install)) - (t (jka-compr-uninstall))))) - - -(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 () (mapconcat @@ -901,6 +873,36 @@ installed)) +;;;###autoload +(define-minor-mode auto-compression-mode + "Toggle automatic file compression and uncompression. +With prefix argument ARG, turn auto compression on if positive, else off. +Returns the new status of auto compression (non-nil means on)." + nil nil nil :global t :group 'jka-compr + (let* ((installed (jka-compr-installed-p)) + (flag auto-compression-mode)) + (cond + ((and flag installed) t) ; already installed + ((and (not flag) (not installed)) nil) ; already not installed + (flag (jka-compr-install)) + (t (jka-compr-uninstall))))) + + +;;;###autoload +(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) + + ;;; Add the file I/O hook if it does not already exist. ;;; Make sure that jka-compr-file-name-handler-entry is eq to the ;;; entry for jka-compr in file-name-handler-alist.