* epa-file.el: Rewritten with file-name-handler.
authorueno <ueno>
Mon, 17 Apr 2006 08:40:53 +0000 (08:40 +0000)
committerueno <ueno>
Mon, 17 Apr 2006 08:40:53 +0000 (08:40 +0000)
(epa-file-handler): New variable.
(epa-file-enable): New command.
(epa-file-disable): New command.
* epa-setup.el: Call epa-file-enable.

ChangeLog
epa-file.el
epa-setup.el

index 126ef3e..1b0be2c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
 2006-04-17  Daiki Ueno  <ueno@unixuser.org>
 
        * epa-file.el: Rewritten with file-name-handler.
+       (epa-file-handler): New variable.
+       (epa-file-enable): New command.
+       (epa-file-disable): New command.
+       * epa-setup.el: Call epa-file-enable.
 
 2006-04-17  Daiki Ueno  <ueno@unixuser.org>
 
index 046997a..efd44fc 100644 (file)
@@ -33,6 +33,9 @@
   "Regexp which matches filenames to be encrypted with GnuPG."
   :type 'regexp
   :group 'epa-file)
+
+(defvar epa-file-handler
+  (cons epa-file-name-regexp 'epa-file-handler))
   
 (defvar epa-file-passphrase-alist nil)
 
@@ -158,6 +161,25 @@ If no one is selected, symmetric encryption will be performed.  ")))))
        (message "Wrote %s" buffer-file-name))))
 (put 'write-region 'epa-file 'epa-file-write-region)
 
+;;;###autoload
+(defun epa-file-enable ()
+  (interactive)
+  (if (memq epa-file-handler file-name-handler-alist)
+      (message "`epa-file' already enabled")
+    (setq file-name-handler-alist
+         (cons epa-file-handler file-name-handler-alist))
+    (message "`epa-file' enabled")))
+
+;;;###autoload
+(defun epa-file-disable ()
+  (interactive)
+  (if (memq epa-file-handler file-name-handler-alist)
+      (progn
+       (setq file-name-handler-alist
+             (delq epa-file-handler file-name-handler-alist))
+       (message "`epa-file' disabled"))
+    (message "`epa-file' already disabled")))
+
 (provide 'epa-file)
 
 ;;; epa-file.el ends here
index 311e553..1272c67 100644 (file)
@@ -2,10 +2,7 @@
 (add-hook 'dired-mode-hook 'epa-dired-mode-hook)
 
 (require 'epa-file)
-(unless (rassq 'epa-file-handler file-name-handler-alist)
-  (setq file-name-handler-alist
-       (cons (cons epa-file-name-regexp 'epa-file-handler)
-             file-name-handler-alist)))
+(epa-file-enable)
 
 (provide 'epa-setup)