From: ueno Date: Mon, 17 Apr 2006 08:40:53 +0000 (+0000) Subject: * epa-file.el: Rewritten with file-name-handler. X-Git-Tag: epgsm-branchpoint~44 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=575912e1f07111c307b7a615cfe91abe1c2ed3d7;p=elisp%2Fepg.git * 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. --- diff --git a/ChangeLog b/ChangeLog index 126ef3e..1b0be2c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ 2006-04-17 Daiki Ueno * 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 diff --git a/epa-file.el b/epa-file.el index 046997a..efd44fc 100644 --- a/epa-file.el +++ b/epa-file.el @@ -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 diff --git a/epa-setup.el b/epa-setup.el index 311e553..1272c67 100644 --- a/epa-setup.el +++ b/epa-setup.el @@ -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)