summaryrefslogtreecommitdiff
path: root/lisp/epa-file.el
diff options
context:
space:
mode:
authorMichael Olson <mwolson@gnu.org>2008-02-10 20:57:47 +0000
committerMichael Olson <mwolson@gnu.org>2008-02-10 20:57:47 +0000
commitf1914c4078082de71933f6cdf7735411e488d045 (patch)
treecfb6b673ff2bb8fdd02e1a5aa7b7e5e96c0d6f18 /lisp/epa-file.el
parentc6588a85bcb0bdcd615f4f34496d71943120e7ae (diff)
downloademacs-f1914c4078082de71933f6cdf7735411e488d045.tar.gz
EasyPG: Implement some suggestions from emacs-devel.
Diffstat (limited to 'lisp/epa-file.el')
-rw-r--r--lisp/epa-file.el18
1 files changed, 18 insertions, 0 deletions
diff --git a/lisp/epa-file.el b/lisp/epa-file.el
index c753d4c37a0..e3c4a83deb8 100644
--- a/lisp/epa-file.el
+++ b/lisp/epa-file.el
@@ -314,6 +314,24 @@ If no one is selected, symmetric encryption will be performed. ")))
(message "`epa-file' disabled"))
(message "`epa-file' already disabled")))
+;;;###autoload
+(define-minor-mode epa-file-mode
+ "Toggle automatic file encryption and decryption.
+With prefix argument ARG, turn auto encryption on if positive, else off.
+Return the new status of auto encryption (non-nil means on)."
+ :global t :init-value nil :group 'epa-file :version "23.1"
+ (setq file-name-handler-alist
+ (delq epa-file-handler file-name-handler-alist))
+ (remove-hook 'find-file-hooks 'epa-file-find-file-hook)
+ (setq auto-mode-alist (delq epa-file-auto-mode-alist-entry
+ auto-mode-alist))
+ (when epa-file-mode
+ (setq file-name-handler-alist
+ (cons epa-file-handler file-name-handler-alist))
+ (add-hook 'find-file-hooks 'epa-file-find-file-hook)
+ (setq auto-mode-alist (cons epa-file-auto-mode-alist-entry
+ auto-mode-alist))))
+
(provide 'epa-file)
;; arch-tag: 5715152f-0eb1-4dbc-9008-07098775314d