+2007-04-04 Daiki Ueno <ueno@unixuser.org>
+
+ * epa-file.el (epa-file-find-file-hook): New function.
+ (epa-file-enable): Add epa-file-find-file-hook to find-file-hooks.
+ (epa-file-disable): Remove epa-file-find-file-hook from
+ find-file-hooks.
+
2007-03-29 Daiki Ueno <ueno@unixuser.org>
* EasyPG: Version 0.0.11 released.
(barf-if-buffer-read-only)
(if (and visit (or beg end))
(error "Attempt to visit less than an entire file"))
- (if epa-file-inhibit-auto-save
- (auto-save-mode 0))
(setq file (expand-file-name file))
(let ((local-copy (epa-file-run-real-handler #'file-local-copy (list file)))
(context (epg-make-context))
(message "Wrote %s" buffer-file-name))))
(put 'write-region 'epa-file 'epa-file-write-region)
+(defun epa-file-find-file-hook ()
+ (if (and buffer-file-name
+ (string-match epa-file-name-regexp buffer-file-name)
+ epa-file-inhibit-auto-save)
+ (auto-save-mode 0)))
+
;;;###autoload
(defun epa-file-enable ()
(interactive)
(message "`epa-file' already enabled")
(setq file-name-handler-alist
(cons epa-file-handler file-name-handler-alist))
+ (add-hook 'find-file-hooks 'epa-file-find-file-hook)
(message "`epa-file' enabled")))
;;;###autoload
(progn
(setq file-name-handler-alist
(delq epa-file-handler file-name-handler-alist))
+ (remove-hook 'find-file-hooks 'epa-file-find-file-hook)
(message "`epa-file' disabled"))
(message "`epa-file' already disabled")))