OSDN Git Service

* epa-file.el (epa-file--file-name-regexp-set): New Custom :set
authorDaiki Ueno <ueno@unixuser.org>
Wed, 4 Apr 2007 09:20:46 +0000 (09:20 +0000)
committerDaiki Ueno <ueno@unixuser.org>
Wed, 4 Apr 2007 09:20:46 +0000 (09:20 +0000)
function.
(epa-file-name-regexp): Use it.
(epa-file-name-regexp-update): New command.
Reported by "[ #10192 ] customizing epa-file-name-regexp fails"

ChangeLog
epa-file.el

index 6075199..b81242a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2007-04-04  Daiki Ueno  <ueno@unixuser.org>
 
+       * 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  <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
index 18e28be..5c3d1a5 100644 (file)
   "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))