Mercurial > emacs
annotate lisp/epa-file.el @ 112212:966cc18ff805
* lisp/mail/mail-utils.el (mail-strip-quoted-names): Make the regexp code
work for nested comments.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Thu, 13 Jan 2011 16:48:34 -0500 |
parents | c6bcd9fc6536 |
children | 417b1e4d63cd |
rev | line source |
---|---|
91647 | 1 ;;; epa-file.el --- the EasyPG Assistant, transparent file encryption |
106815 | 2 ;; Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
91647 | 3 |
4 ;; Author: Daiki Ueno <ueno@unixuser.org> | |
5 ;; Keywords: PGP, GnuPG | |
110015
280c8ae2476d
Add "Package:" file headers to denote built-in packages.
Chong Yidong <cyd@stupidchicken.com>
parents:
109535
diff
changeset
|
6 ;; Package: epa |
91647 | 7 |
8 ;; This file is part of GNU Emacs. | |
9 | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94512
diff
changeset
|
10 ;; GNU Emacs is free software: you can redistribute it and/or modify |
91647 | 11 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94512
diff
changeset
|
12 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94512
diff
changeset
|
13 ;; (at your option) any later version. |
91647 | 14 |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94512
diff
changeset
|
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
91647 | 22 |
23 ;;; Code: | |
24 | |
25 (require 'epa) | |
94755
14eda1195ec3
Provide/require epa-hook, not epa-file-hook.
Eli Zaretskii <eliz@gnu.org>
parents:
94678
diff
changeset
|
26 (require 'epa-hook) |
91647 | 27 |
28 (defcustom epa-file-cache-passphrase-for-symmetric-encryption nil | |
105120
e9b2a988e884
(epa-file-cache-passphrase-for-symmetric-encryption):
Daiki Ueno <ueno@unixuser.org>
parents:
103016
diff
changeset
|
29 "If non-nil, cache passphrase for symmetric encryption. |
e9b2a988e884
(epa-file-cache-passphrase-for-symmetric-encryption):
Daiki Ueno <ueno@unixuser.org>
parents:
103016
diff
changeset
|
30 |
e9b2a988e884
(epa-file-cache-passphrase-for-symmetric-encryption):
Daiki Ueno <ueno@unixuser.org>
parents:
103016
diff
changeset
|
31 For security reasons, this option is turned off by default and |
105121 | 32 not recommended to use. Instead, consider using public-key |
33 encryption with gpg-agent which does the same job in a safer | |
34 way." | |
91647 | 35 :type 'boolean |
36 :group 'epa-file) | |
37 | |
111977
c6bcd9fc6536
Extend epa-file-select-keys to allow users to inhibit key selection.
Daiki Ueno <ueno@unixuser.org>
parents:
110899
diff
changeset
|
38 (defcustom epa-file-select-keys 'silent |
c6bcd9fc6536
Extend epa-file-select-keys to allow users to inhibit key selection.
Daiki Ueno <ueno@unixuser.org>
parents:
110899
diff
changeset
|
39 "Control whether or not to pop up the key selection dialog. |
c6bcd9fc6536
Extend epa-file-select-keys to allow users to inhibit key selection.
Daiki Ueno <ueno@unixuser.org>
parents:
110899
diff
changeset
|
40 |
c6bcd9fc6536
Extend epa-file-select-keys to allow users to inhibit key selection.
Daiki Ueno <ueno@unixuser.org>
parents:
110899
diff
changeset
|
41 If t, always asks user to select recipients. |
c6bcd9fc6536
Extend epa-file-select-keys to allow users to inhibit key selection.
Daiki Ueno <ueno@unixuser.org>
parents:
110899
diff
changeset
|
42 If nil, query user only when `epa-file-encrypt-to' is not set. |
c6bcd9fc6536
Extend epa-file-select-keys to allow users to inhibit key selection.
Daiki Ueno <ueno@unixuser.org>
parents:
110899
diff
changeset
|
43 If neither t nor nil, doesn't ask user. In this case, symmetric |
c6bcd9fc6536
Extend epa-file-select-keys to allow users to inhibit key selection.
Daiki Ueno <ueno@unixuser.org>
parents:
110899
diff
changeset
|
44 encryption is used." |
c6bcd9fc6536
Extend epa-file-select-keys to allow users to inhibit key selection.
Daiki Ueno <ueno@unixuser.org>
parents:
110899
diff
changeset
|
45 :type '(choice (const :tag "Ask always" t) |
c6bcd9fc6536
Extend epa-file-select-keys to allow users to inhibit key selection.
Daiki Ueno <ueno@unixuser.org>
parents:
110899
diff
changeset
|
46 (const :tag "Ask when recipients are not set" nil) |
c6bcd9fc6536
Extend epa-file-select-keys to allow users to inhibit key selection.
Daiki Ueno <ueno@unixuser.org>
parents:
110899
diff
changeset
|
47 (const :tag "Don't ask" silent)) |
91647 | 48 :group 'epa-file) |
49 | |
50 (defvar epa-file-passphrase-alist nil) | |
51 | |
52 (eval-and-compile | |
53 (if (fboundp 'encode-coding-string) | |
54 (defalias 'epa-file--encode-coding-string 'encode-coding-string) | |
55 (defalias 'epa-file--encode-coding-string 'identity))) | |
56 | |
57 (eval-and-compile | |
58 (if (fboundp 'decode-coding-string) | |
59 (defalias 'epa-file--decode-coding-string 'decode-coding-string) | |
60 (defalias 'epa-file--decode-coding-string 'identity))) | |
61 | |
62 (defun epa-file-passphrase-callback-function (context key-id file) | |
63 (if (and epa-file-cache-passphrase-for-symmetric-encryption | |
64 (eq key-id 'SYM)) | |
65 (progn | |
66 (setq file (file-truename file)) | |
67 (let ((entry (assoc file epa-file-passphrase-alist)) | |
68 passphrase) | |
69 (or (copy-sequence (cdr entry)) | |
70 (progn | |
71 (unless entry | |
72 (setq entry (list file) | |
73 epa-file-passphrase-alist | |
74 (cons entry | |
75 epa-file-passphrase-alist))) | |
76 (setq passphrase (epa-passphrase-callback-function context | |
110899 | 77 key-id |
78 file)) | |
91647 | 79 (setcdr entry (copy-sequence passphrase)) |
80 passphrase)))) | |
110899 | 81 (epa-passphrase-callback-function context key-id file))) |
91647 | 82 |
94512
d10cd2d8d9ae
* epa-file-hook.el: New file split from epa-file.el.
Daiki Ueno <ueno@unixuser.org>
parents:
94423
diff
changeset
|
83 ;;;###autoload |
91647 | 84 (defun epa-file-handler (operation &rest args) |
94423
3898a5665f50
Daiki Ueno <ueno at unixuser.org>
Glenn Morris <rgm@gnu.org>
parents:
94419
diff
changeset
|
85 (save-match-data |
3898a5665f50
Daiki Ueno <ueno at unixuser.org>
Glenn Morris <rgm@gnu.org>
parents:
94419
diff
changeset
|
86 (let ((op (get operation 'epa-file))) |
3898a5665f50
Daiki Ueno <ueno at unixuser.org>
Glenn Morris <rgm@gnu.org>
parents:
94419
diff
changeset
|
87 (if op |
3898a5665f50
Daiki Ueno <ueno at unixuser.org>
Glenn Morris <rgm@gnu.org>
parents:
94419
diff
changeset
|
88 (apply op args) |
3898a5665f50
Daiki Ueno <ueno at unixuser.org>
Glenn Morris <rgm@gnu.org>
parents:
94419
diff
changeset
|
89 (epa-file-run-real-handler operation args))))) |
3898a5665f50
Daiki Ueno <ueno at unixuser.org>
Glenn Morris <rgm@gnu.org>
parents:
94419
diff
changeset
|
90 |
91647 | 91 (defun epa-file-run-real-handler (operation args) |
92 (let ((inhibit-file-name-handlers | |
93 (cons 'epa-file-handler | |
94 (and (eq inhibit-file-name-operation operation) | |
95 inhibit-file-name-handlers))) | |
96 (inhibit-file-name-operation operation)) | |
97 (apply operation args))) | |
98 | |
99 (defun epa-file-decode-and-insert (string file visit beg end replace) | |
100 (if (fboundp 'decode-coding-inserted-region) | |
101 (save-restriction | |
102 (narrow-to-region (point) (point)) | |
103016
15551118906e
epa-file: fix garble with decode-coding-inserted-region
Daiki Ueno <ueno@unixuser.org>
parents:
100908
diff
changeset
|
103 (insert (if enable-multibyte-characters |
15551118906e
epa-file: fix garble with decode-coding-inserted-region
Daiki Ueno <ueno@unixuser.org>
parents:
100908
diff
changeset
|
104 (string-to-multibyte string) |
15551118906e
epa-file: fix garble with decode-coding-inserted-region
Daiki Ueno <ueno@unixuser.org>
parents:
100908
diff
changeset
|
105 string)) |
91647 | 106 (decode-coding-inserted-region |
107 (point-min) (point-max) | |
108 (substring file 0 (string-match epa-file-name-regexp file)) | |
103016
15551118906e
epa-file: fix garble with decode-coding-inserted-region
Daiki Ueno <ueno@unixuser.org>
parents:
100908
diff
changeset
|
109 visit beg end replace)) |
91647 | 110 (insert (epa-file--decode-coding-string string (or coding-system-for-read |
111 'undecided))))) | |
112 | |
109166
b70c159d9e1e
Prevent find-file from opening empty buffer when decryptin failed (bug#6568).
Daiki Ueno <ueno@unixuser.org>
parents:
106815
diff
changeset
|
113 (defvar epa-file-error nil) |
b70c159d9e1e
Prevent find-file from opening empty buffer when decryptin failed (bug#6568).
Daiki Ueno <ueno@unixuser.org>
parents:
106815
diff
changeset
|
114 (defun epa-file--find-file-not-found-function () |
b70c159d9e1e
Prevent find-file from opening empty buffer when decryptin failed (bug#6568).
Daiki Ueno <ueno@unixuser.org>
parents:
106815
diff
changeset
|
115 (let ((error epa-file-error)) |
b70c159d9e1e
Prevent find-file from opening empty buffer when decryptin failed (bug#6568).
Daiki Ueno <ueno@unixuser.org>
parents:
106815
diff
changeset
|
116 (save-window-excursion |
b70c159d9e1e
Prevent find-file from opening empty buffer when decryptin failed (bug#6568).
Daiki Ueno <ueno@unixuser.org>
parents:
106815
diff
changeset
|
117 (kill-buffer)) |
b70c159d9e1e
Prevent find-file from opening empty buffer when decryptin failed (bug#6568).
Daiki Ueno <ueno@unixuser.org>
parents:
106815
diff
changeset
|
118 (signal 'file-error |
b70c159d9e1e
Prevent find-file from opening empty buffer when decryptin failed (bug#6568).
Daiki Ueno <ueno@unixuser.org>
parents:
106815
diff
changeset
|
119 (cons "Opening input file" (cdr error))))) |
b70c159d9e1e
Prevent find-file from opening empty buffer when decryptin failed (bug#6568).
Daiki Ueno <ueno@unixuser.org>
parents:
106815
diff
changeset
|
120 |
91647 | 121 (defvar last-coding-system-used) |
122 (defun epa-file-insert-file-contents (file &optional visit beg end replace) | |
123 (barf-if-buffer-read-only) | |
124 (if (and visit (or beg end)) | |
125 (error "Attempt to visit less than an entire file")) | |
126 (setq file (expand-file-name file)) | |
127 (let* ((local-copy | |
98409
cb5ef7767703
(epa-file-insert-file-contents): Fix typo.
Daiki Ueno <ueno@unixuser.org>
parents:
95478
diff
changeset
|
128 (condition-case nil |
91647 | 129 (epa-file-run-real-handler #'file-local-copy (list file)) |
130 (error))) | |
131 (local-file (or local-copy file)) | |
132 (context (epg-make-context)) | |
133 string length entry) | |
100456
e4798aef9a53
* epa-file.el (epa-file-insert-file-contents): Set
Daiki Ueno <ueno@unixuser.org>
parents:
100304
diff
changeset
|
134 (if visit |
e4798aef9a53
* epa-file.el (epa-file-insert-file-contents): Set
Daiki Ueno <ueno@unixuser.org>
parents:
100304
diff
changeset
|
135 (setq buffer-file-name file)) |
91647 | 136 (epg-context-set-passphrase-callback |
137 context | |
138 (cons #'epa-file-passphrase-callback-function | |
139 local-file)) | |
140 (epg-context-set-progress-callback context | |
141 #'epa-progress-callback-function) | |
142 (unwind-protect | |
143 (progn | |
144 (if replace | |
145 (goto-char (point-min))) | |
146 (condition-case error | |
147 (setq string (epg-decrypt-file context local-file nil)) | |
148 (error | |
149 (if (setq entry (assoc file epa-file-passphrase-alist)) | |
150 (setcdr entry nil)) | |
109535 | 151 ;; Hack to prevent find-file from opening empty buffer |
152 ;; when decryption failed (bug#6568). See the place | |
153 ;; where `find-file-not-found-functions' are called in | |
154 ;; `find-file-noselect-1'. | |
109534
52f611292230
Fix *.gpg file creation (bug#6723).
Daiki Ueno <ueno@unixuser.org>
parents:
109166
diff
changeset
|
155 (when (file-exists-p local-file) |
52f611292230
Fix *.gpg file creation (bug#6723).
Daiki Ueno <ueno@unixuser.org>
parents:
109166
diff
changeset
|
156 (make-local-variable 'epa-file-error) |
52f611292230
Fix *.gpg file creation (bug#6723).
Daiki Ueno <ueno@unixuser.org>
parents:
109166
diff
changeset
|
157 (setq epa-file-error error) |
52f611292230
Fix *.gpg file creation (bug#6723).
Daiki Ueno <ueno@unixuser.org>
parents:
109166
diff
changeset
|
158 (add-hook 'find-file-not-found-functions |
52f611292230
Fix *.gpg file creation (bug#6723).
Daiki Ueno <ueno@unixuser.org>
parents:
109166
diff
changeset
|
159 'epa-file--find-file-not-found-function |
52f611292230
Fix *.gpg file creation (bug#6723).
Daiki Ueno <ueno@unixuser.org>
parents:
109166
diff
changeset
|
160 nil t)) |
91647 | 161 (signal 'file-error |
162 (cons "Opening input file" (cdr error))))) | |
163 (make-local-variable 'epa-file-encrypt-to) | |
164 (setq epa-file-encrypt-to | |
165 (mapcar #'car (epg-context-result-for context 'encrypted-to))) | |
166 (if (or beg end) | |
167 (setq string (substring string (or beg 0) end))) | |
168 (save-excursion | |
110318
3386110d149b
epa-file: suppress file-locking question on M-x revert-buffer
Daiki Ueno <ueno@unixuser.org>
parents:
110015
diff
changeset
|
169 ;; If visiting, bind off buffer-file-name so that |
3386110d149b
epa-file: suppress file-locking question on M-x revert-buffer
Daiki Ueno <ueno@unixuser.org>
parents:
110015
diff
changeset
|
170 ;; file-locking will not ask whether we should |
3386110d149b
epa-file: suppress file-locking question on M-x revert-buffer
Daiki Ueno <ueno@unixuser.org>
parents:
110015
diff
changeset
|
171 ;; really edit the buffer. |
3386110d149b
epa-file: suppress file-locking question on M-x revert-buffer
Daiki Ueno <ueno@unixuser.org>
parents:
110015
diff
changeset
|
172 (let ((buffer-file-name |
3386110d149b
epa-file: suppress file-locking question on M-x revert-buffer
Daiki Ueno <ueno@unixuser.org>
parents:
110015
diff
changeset
|
173 (if visit nil buffer-file-name))) |
3386110d149b
epa-file: suppress file-locking question on M-x revert-buffer
Daiki Ueno <ueno@unixuser.org>
parents:
110015
diff
changeset
|
174 (save-restriction |
3386110d149b
epa-file: suppress file-locking question on M-x revert-buffer
Daiki Ueno <ueno@unixuser.org>
parents:
110015
diff
changeset
|
175 (narrow-to-region (point) (point)) |
3386110d149b
epa-file: suppress file-locking question on M-x revert-buffer
Daiki Ueno <ueno@unixuser.org>
parents:
110015
diff
changeset
|
176 (epa-file-decode-and-insert string file visit beg end replace) |
3386110d149b
epa-file: suppress file-locking question on M-x revert-buffer
Daiki Ueno <ueno@unixuser.org>
parents:
110015
diff
changeset
|
177 (setq length (- (point-max) (point-min)))) |
3386110d149b
epa-file: suppress file-locking question on M-x revert-buffer
Daiki Ueno <ueno@unixuser.org>
parents:
110015
diff
changeset
|
178 (if replace |
3386110d149b
epa-file: suppress file-locking question on M-x revert-buffer
Daiki Ueno <ueno@unixuser.org>
parents:
110015
diff
changeset
|
179 (delete-region (point) (point-max)))) |
100456
e4798aef9a53
* epa-file.el (epa-file-insert-file-contents): Set
Daiki Ueno <ueno@unixuser.org>
parents:
100304
diff
changeset
|
180 (if visit |
e4798aef9a53
* epa-file.el (epa-file-insert-file-contents): Set
Daiki Ueno <ueno@unixuser.org>
parents:
100304
diff
changeset
|
181 (set-visited-file-modtime)))) |
91647 | 182 (if (and local-copy |
183 (file-exists-p local-copy)) | |
184 (delete-file local-copy))) | |
185 (list file length))) | |
186 (put 'insert-file-contents 'epa-file 'epa-file-insert-file-contents) | |
187 | |
188 (defun epa-file-write-region (start end file &optional append visit lockname | |
189 mustbenew) | |
190 (if append | |
105170 | 191 (error "Can't append to the file")) |
91647 | 192 (setq file (expand-file-name file)) |
193 (let* ((coding-system (or coding-system-for-write | |
194 (if (fboundp 'select-safe-coding-system) | |
195 ;; This is needed since Emacs 22 has | |
196 ;; no-conversion setting for *.gpg in | |
197 ;; `auto-coding-alist'. | |
198 (let ((buffer-file-name | |
199 (file-name-sans-extension file))) | |
200 (select-safe-coding-system | |
201 (point-min) (point-max))) | |
202 buffer-file-coding-system))) | |
203 (context (epg-make-context)) | |
204 (coding-system-for-write 'binary) | |
205 string entry | |
206 (recipients | |
207 (cond | |
208 ((listp epa-file-encrypt-to) epa-file-encrypt-to) | |
209 ((stringp epa-file-encrypt-to) (list epa-file-encrypt-to))))) | |
210 (epg-context-set-passphrase-callback | |
211 context | |
212 (cons #'epa-file-passphrase-callback-function | |
213 file)) | |
214 (epg-context-set-progress-callback context | |
215 #'epa-progress-callback-function) | |
216 (epg-context-set-armor context epa-armor) | |
217 (condition-case error | |
218 (setq string | |
219 (epg-encrypt-string | |
220 context | |
221 (if (stringp start) | |
222 (epa-file--encode-coding-string start coding-system) | |
95477
57f3dde2b9be
(epa-file-write-region): Write the entire buffer
Daiki Ueno <ueno@unixuser.org>
parents:
94755
diff
changeset
|
223 (unless start |
95478 | 224 (setq start (point-min) |
225 end (point-max))) | |
91647 | 226 (epa-file--encode-coding-string (buffer-substring start end) |
227 coding-system)) | |
111977
c6bcd9fc6536
Extend epa-file-select-keys to allow users to inhibit key selection.
Daiki Ueno <ueno@unixuser.org>
parents:
110899
diff
changeset
|
228 (if (or (eq epa-file-select-keys t) |
c6bcd9fc6536
Extend epa-file-select-keys to allow users to inhibit key selection.
Daiki Ueno <ueno@unixuser.org>
parents:
110899
diff
changeset
|
229 (and (null epa-file-select-keys) |
c6bcd9fc6536
Extend epa-file-select-keys to allow users to inhibit key selection.
Daiki Ueno <ueno@unixuser.org>
parents:
110899
diff
changeset
|
230 (not (local-variable-p 'epa-file-encrypt-to |
c6bcd9fc6536
Extend epa-file-select-keys to allow users to inhibit key selection.
Daiki Ueno <ueno@unixuser.org>
parents:
110899
diff
changeset
|
231 (current-buffer))))) |
91647 | 232 (epa-select-keys |
233 context | |
234 "Select recipents for encryption. | |
235 If no one is selected, symmetric encryption will be performed. " | |
236 recipients) | |
237 (if epa-file-encrypt-to | |
238 (epg-list-keys context recipients))))) | |
239 (error | |
240 (if (setq entry (assoc file epa-file-passphrase-alist)) | |
241 (setcdr entry nil)) | |
242 (signal 'file-error (cons "Opening output file" (cdr error))))) | |
243 (epa-file-run-real-handler | |
244 #'write-region | |
245 (list string nil file append visit lockname mustbenew)) | |
246 (if (boundp 'last-coding-system-used) | |
247 (setq last-coding-system-used coding-system)) | |
248 (if (eq visit t) | |
249 (progn | |
250 (setq buffer-file-name file) | |
251 (set-visited-file-modtime)) | |
252 (if (stringp visit) | |
253 (progn | |
254 (set-visited-file-modtime) | |
255 (setq buffer-file-name visit)))) | |
256 (if (or (eq visit t) | |
257 (eq visit nil) | |
258 (stringp visit)) | |
259 (message "Wrote %s" buffer-file-name)))) | |
260 (put 'write-region 'epa-file 'epa-file-write-region) | |
261 | |
262 (defun epa-file-select-keys () | |
263 "Select recipients for encryption." | |
264 (interactive) | |
265 (make-local-variable 'epa-file-encrypt-to) | |
266 (setq epa-file-encrypt-to | |
93002
d876f5372472
EasyPG: Fix bug with C-x C-s after M-x epa-file-select-keys.
Michael Olson <mwolson@gnu.org>
parents:
91731
diff
changeset
|
267 (mapcar |
d876f5372472
EasyPG: Fix bug with C-x C-s after M-x epa-file-select-keys.
Michael Olson <mwolson@gnu.org>
parents:
91731
diff
changeset
|
268 (lambda (key) |
d876f5372472
EasyPG: Fix bug with C-x C-s after M-x epa-file-select-keys.
Michael Olson <mwolson@gnu.org>
parents:
91731
diff
changeset
|
269 (epg-sub-key-id (car (epg-key-sub-key-list key)))) |
91647 | 270 (epa-select-keys |
271 (epg-make-context) | |
272 "Select recipents for encryption. | |
93002
d876f5372472
EasyPG: Fix bug with C-x C-s after M-x epa-file-select-keys.
Michael Olson <mwolson@gnu.org>
parents:
91731
diff
changeset
|
273 If no one is selected, symmetric encryption will be performed. ")))) |
91647 | 274 |
275 ;;;###autoload | |
276 (defun epa-file-enable () | |
277 (interactive) | |
278 (if (memq epa-file-handler file-name-handler-alist) | |
279 (message "`epa-file' already enabled") | |
280 (setq file-name-handler-alist | |
281 (cons epa-file-handler file-name-handler-alist)) | |
94417
1a8916b995cf
* epa-file.el (auto-encryption-mode): Rename from epa-file-mode.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93002
diff
changeset
|
282 (add-hook 'find-file-hook 'epa-file-find-file-hook) |
91647 | 283 (setq auto-mode-alist (cons epa-file-auto-mode-alist-entry auto-mode-alist)) |
284 (message "`epa-file' enabled"))) | |
285 | |
286 ;;;###autoload | |
287 (defun epa-file-disable () | |
288 (interactive) | |
289 (if (memq epa-file-handler file-name-handler-alist) | |
290 (progn | |
291 (setq file-name-handler-alist | |
292 (delq epa-file-handler file-name-handler-alist)) | |
94417
1a8916b995cf
* epa-file.el (auto-encryption-mode): Rename from epa-file-mode.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93002
diff
changeset
|
293 (remove-hook 'find-file-hook 'epa-file-find-file-hook) |
91647 | 294 (setq auto-mode-alist (delq epa-file-auto-mode-alist-entry |
295 auto-mode-alist)) | |
296 (message "`epa-file' disabled")) | |
297 (message "`epa-file' already disabled"))) | |
298 | |
299 (provide 'epa-file) | |
300 | |
91687 | 301 ;; arch-tag: 5715152f-0eb1-4dbc-9008-07098775314d |
91647 | 302 ;;; epa-file.el ends here |