aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader2000-10-08 02:58:24 +0000
committerMiles Bader2000-10-08 02:58:24 +0000
commit6fee86a3c9c799c856894f9f2f78d5f9256d8799 (patch)
tree2eb2cfd99e6e88bd9b57f95aee5a399c20657e83
parenta43709e643cb34622422a35efa477ab7895fd530 (diff)
downloademacs-6fee86a3c9c799c856894f9f2f78d5f9256d8799.tar.gz
emacs-6fee86a3c9c799c856894f9f2f78d5f9256d8799.zip
(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.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/jka-compr.el58
2 files changed, 38 insertions, 28 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f905f48b45c..66866f15bc5 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12000-10-08 Miles Bader <miles@gnu.org>
2
3 * jka-compr.el (auto-compression-mode): Move to the end of the
4 file, because `define-minor-mode' actually calls the mode-function
5 if the associated variable is non-nil, which requires that all
6 needed functions be already defined.
7 (with-auto-compression-mode): Add autoload cookie.
8
12000-10-07 Eli Zaretskii <eliz@is.elta.co.il> 92000-10-07 Eli Zaretskii <eliz@is.elta.co.il>
2 10
3 * files.el (find-backup-file-name) [ms-dos]: If support for long 11 * files.el (find-backup-file-name) [ms-dos]: If support for long
diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el
index 3938590cabc..9adeddfefa7 100644
--- a/lisp/jka-compr.el
+++ b/lisp/jka-compr.el
@@ -755,34 +755,6 @@ It is not recommended to set this variable permanently to anything but nil.")
755 (inhibit-file-name-operation operation)) 755 (inhibit-file-name-operation operation))
756 (apply operation args))) 756 (apply operation args)))
757 757
758;;;###autoload
759(define-minor-mode auto-compression-mode
760 "Toggle automatic file compression and uncompression.
761With prefix argument ARG, turn auto compression on if positive, else off.
762Returns the new status of auto compression (non-nil means on)."
763 nil nil nil :global t :group 'jka-compr
764 (let* ((installed (jka-compr-installed-p))
765 (flag auto-compression-mode))
766 (cond
767 ((and flag installed) t) ; already installed
768 ((and (not flag) (not installed)) nil) ; already not installed
769 (flag (jka-compr-install))
770 (t (jka-compr-uninstall)))))
771
772
773(defmacro with-auto-compression-mode (&rest body)
774 "Evalutes BODY with automatic file compression and uncompression enabled."
775 (let ((already-installed (make-symbol "already-installed")))
776 `(let ((,already-installed (jka-compr-installed-p)))
777 (unwind-protect
778 (progn
779 (unless ,already-installed
780 (jka-compr-install))
781 ,@body)
782 (unless ,already-installed
783 (jka-compr-uninstall))))))
784(put 'with-auto-compression-mode 'lisp-indent-function 0)
785
786 758
787(defun jka-compr-build-file-regexp () 759(defun jka-compr-build-file-regexp ()
788 (mapconcat 760 (mapconcat
@@ -901,6 +873,36 @@ The return value is the entry in `file-name-handler-alist' for jka-compr."
901 installed)) 873 installed))
902 874
903 875
876;;;###autoload
877(define-minor-mode auto-compression-mode
878 "Toggle automatic file compression and uncompression.
879With prefix argument ARG, turn auto compression on if positive, else off.
880Returns the new status of auto compression (non-nil means on)."
881 nil nil nil :global t :group 'jka-compr
882 (let* ((installed (jka-compr-installed-p))
883 (flag auto-compression-mode))
884 (cond
885 ((and flag installed) t) ; already installed
886 ((and (not flag) (not installed)) nil) ; already not installed
887 (flag (jka-compr-install))
888 (t (jka-compr-uninstall)))))
889
890
891;;;###autoload
892(defmacro with-auto-compression-mode (&rest body)
893 "Evalutes BODY with automatic file compression and uncompression enabled."
894 (let ((already-installed (make-symbol "already-installed")))
895 `(let ((,already-installed (jka-compr-installed-p)))
896 (unwind-protect
897 (progn
898 (unless ,already-installed
899 (jka-compr-install))
900 ,@body)
901 (unless ,already-installed
902 (jka-compr-uninstall))))))
903(put 'with-auto-compression-mode 'lisp-indent-function 0)
904
905
904;;; Add the file I/O hook if it does not already exist. 906;;; Add the file I/O hook if it does not already exist.
905;;; Make sure that jka-compr-file-name-handler-entry is eq to the 907;;; Make sure that jka-compr-file-name-handler-entry is eq to the
906;;; entry for jka-compr in file-name-handler-alist. 908;;; entry for jka-compr in file-name-handler-alist.