From 4557c2850717d6b69e4bdd352279cb82bea227c2 Mon Sep 17 00:00:00 2001 From: ueno Date: Wed, 4 Apr 2007 09:20:46 +0000 Subject: [PATCH] * epa-file.el (epa-file--file-name-regexp-set): New Custom :set function. (epa-file-name-regexp): Use it. (epa-file-name-regexp-update): New command. Reported by "[ #10192 ] customizing epa-file-name-regexp fails" --- ChangeLog | 8 ++++++++ epa-file.el | 20 ++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6075199..b81242a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2007-04-04 Daiki Ueno + * epa-file.el (epa-file--file-name-regexp-set): New Custom :set + function. + (epa-file-name-regexp): Use it. + (epa-file-name-regexp-update): New command. + Reported by "[ #10192 ] customizing epa-file-name-regexp fails" + +2007-04-04 Daiki Ueno + * 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 diff --git a/epa-file.el b/epa-file.el index 18e28be..5c3d1a5 100644 --- a/epa-file.el +++ b/epa-file.el @@ -29,10 +29,21 @@ "The EasyPG Assistant hooks for transparent file encryption" :group 'epa) +(defun epa-file--file-name-regexp-set (variable value) + (set-default variable value) + (if (fboundp 'epa-file-name-regexp-update) + (epa-file-name-regexp-update))) + (defcustom epa-file-name-regexp "\\.gpg\\'" - "Regexp which matches filenames to be encrypted with GnuPG." + "Regexp which matches filenames to be encrypted with GnuPG. + +If you set this outside Custom while epa-file is already enabled, you +have to call `epa-file-name-regexp-update' after setting it to +properly update file-name-handler-alist. Setting this through Custom +does that automatically." :type 'regexp - :group 'epa-file) + :group 'epa-file + :set 'epa-file--file-name-regexp-set) (defcustom epa-file-cache-passphrase-for-symmetric-encryption nil "If non-nil, cache passphrase for symmetric encryption." @@ -73,6 +84,11 @@ May either be a string or a list of strings.") (defalias 'epa-file--decode-coding-string 'decode-coding-string) (defalias 'epa-file--decode-coding-string 'identity)) +(defun epa-file-name-regexp-update () + (interactive) + (unless (equal (car epa-file-handler) epa-file-name-regexp) + (setcar epa-file-handler epa-file-name-regexp))) + (defun epa-file-passphrase-callback-function (context key-id file) (if (and epa-file-cache-passphrase-for-symmetric-encryption (eq key-id 'SYM)) -- 1.7.10.4