diff options
| author | Stefan Monnier | 2000-09-29 02:38:03 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2000-09-29 02:38:03 +0000 |
| commit | defdd32e04c52e2178579e694e7e25071c94002e (patch) | |
| tree | 5291df609141f14c7d1ef2fbfa847287aaeac081 | |
| parent | 143736774c7345133cf7dc574c63fd8ba39d0799 (diff) | |
| download | emacs-defdd32e04c52e2178579e694e7e25071c94002e.tar.gz emacs-defdd32e04c52e2178579e694e7e25071c94002e.zip | |
(auto-compression-mode): Use define-minor-mode.
(toggle-auto-compression): Remove.
(jka-compr-build-file-regexp): Remove useless grouping.
| -rw-r--r-- | lisp/jka-compr.el | 66 |
1 files changed, 10 insertions, 56 deletions
diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el index 1d67272008e..3938590cabc 100644 --- a/lisp/jka-compr.el +++ b/lisp/jka-compr.el | |||
| @@ -756,61 +756,18 @@ It is not recommended to set this variable permanently to anything but nil.") | |||
| 756 | (apply operation args))) | 756 | (apply operation args))) |
| 757 | 757 | ||
| 758 | ;;;###autoload | 758 | ;;;###autoload |
| 759 | (defcustom auto-compression-mode nil | 759 | (define-minor-mode auto-compression-mode |
| 760 | "Toggle automatic file compression and uncompression. | ||
| 761 | Setting this variable directly does not take effect; | ||
| 762 | use either \\[customize] or the function `auto-compression-mode'." | ||
| 763 | :set (lambda (symbol value) | ||
| 764 | (auto-compression-mode (or value 0))) | ||
| 765 | :initialize 'custom-initialize-default | ||
| 766 | :group 'jka-compr | ||
| 767 | :version "21.1" | ||
| 768 | :type 'boolean | ||
| 769 | :require 'jka-compr) | ||
| 770 | |||
| 771 | ;;;###autoload(defun auto-compression-mode (&optional arg) | ||
| 772 | ;;;###autoload "\ | ||
| 773 | ;;;###autoloadToggle automatic file compression and uncompression. | ||
| 774 | ;;;###autoloadWith prefix argument ARG, turn auto compression on if positive, else off. | ||
| 775 | ;;;###autoloadReturns the new status of auto compression (non-nil means on)." | ||
| 776 | ;;;###autoload (interactive "P") | ||
| 777 | ;;;###autoload (if (not (fboundp 'jka-compr-installed-p)) | ||
| 778 | ;;;###autoload (progn | ||
| 779 | ;;;###autoload (require 'jka-compr) | ||
| 780 | ;;;###autoload ;; That turned the mode on, so make it initially off. | ||
| 781 | ;;;###autoload (toggle-auto-compression))) | ||
| 782 | ;;;###autoload (toggle-auto-compression arg t)) | ||
| 783 | |||
| 784 | (defun toggle-auto-compression (&optional arg message) | ||
| 785 | "Toggle automatic file compression and uncompression. | 760 | "Toggle automatic file compression and uncompression. |
| 786 | With prefix argument ARG, turn auto compression on if positive, else off. | 761 | With prefix argument ARG, turn auto compression on if positive, else off. |
| 787 | Returns the new status of auto compression (non-nil means on). | 762 | Returns the new status of auto compression (non-nil means on)." |
| 788 | If the argument MESSAGE is non-nil, it means to print a message | 763 | nil nil nil :global t :group 'jka-compr |
| 789 | saying whether the mode is now on or off." | ||
| 790 | (interactive "P\np") | ||
| 791 | (let* ((installed (jka-compr-installed-p)) | 764 | (let* ((installed (jka-compr-installed-p)) |
| 792 | (flag (if (null arg) | 765 | (flag auto-compression-mode)) |
| 793 | (not installed) | ||
| 794 | (or (eq arg t) (listp arg) (and (integerp arg) (> arg 0)))))) | ||
| 795 | |||
| 796 | (cond | 766 | (cond |
| 797 | ((and flag installed) t) ; already installed | 767 | ((and flag installed) t) ; already installed |
| 798 | |||
| 799 | ((and (not flag) (not installed)) nil) ; already not installed | 768 | ((and (not flag) (not installed)) nil) ; already not installed |
| 800 | 769 | (flag (jka-compr-install)) | |
| 801 | (flag | 770 | (t (jka-compr-uninstall))))) |
| 802 | (jka-compr-install)) | ||
| 803 | |||
| 804 | (t | ||
| 805 | (jka-compr-uninstall))) | ||
| 806 | |||
| 807 | |||
| 808 | (and message | ||
| 809 | (if flag | ||
| 810 | (message "Automatic file (de)compression is now ON.") | ||
| 811 | (message "Automatic file (de)compression is now OFF."))) | ||
| 812 | |||
| 813 | flag)) | ||
| 814 | 771 | ||
| 815 | 772 | ||
| 816 | (defmacro with-auto-compression-mode (&rest body) | 773 | (defmacro with-auto-compression-mode (&rest body) |
| @@ -828,13 +785,10 @@ saying whether the mode is now on or off." | |||
| 828 | 785 | ||
| 829 | 786 | ||
| 830 | (defun jka-compr-build-file-regexp () | 787 | (defun jka-compr-build-file-regexp () |
| 831 | (concat | 788 | (mapconcat |
| 832 | "\\(" | 789 | 'jka-compr-info-regexp |
| 833 | (mapconcat | 790 | jka-compr-compression-info-list |
| 834 | 'jka-compr-info-regexp | 791 | "\\|")) |
| 835 | jka-compr-compression-info-list | ||
| 836 | "\\)\\|\\(") | ||
| 837 | "\\)")) | ||
| 838 | 792 | ||
| 839 | 793 | ||
| 840 | (defun jka-compr-install () | 794 | (defun jka-compr-install () |