From 575912e1f07111c307b7a615cfe91abe1c2ed3d7 Mon Sep 17 00:00:00 2001 From: ueno Date: Mon, 17 Apr 2006 08:40:53 +0000 Subject: [PATCH] * 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. --- ChangeLog | 4 ++++ epa-file.el | 22 ++++++++++++++++++++++ epa-setup.el | 5 +---- 3 files changed, 27 insertions(+), 4 deletions(-) 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) -- 1.7.10.4