annotate lisp/epa-hook.el @ 110279:9be76f41f36f

Merge changes made in Gnus trunk: gnus-html.el (gnus-html-schedule-image-fetching): Decode entities before feeding URLs to curl. gnus-async.el (gnus-async-article-callback): Call `gnus-html-prefetch-images' unconditionally. gnus-html.el: Allow showing the ALT text of images and to browse the images themselves. gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Thu, 09 Sep 2010 00:10:08 +0000
parents 280c8ae2476d
children 417b1e4d63cd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
94752
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1 ;;; epa-hook.el --- preloaded code to enable epa-file.el
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 105870
diff changeset
2 ;; Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
94752
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
3
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
4 ;; Author: Daiki Ueno <ueno@unixuser.org>
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
5 ;; Keywords: PGP, GnuPG
110015
280c8ae2476d Add "Package:" file headers to denote built-in packages.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
6 ;; Package: emacs
94752
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
7
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
9
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
12 ;; the Free Software Foundation, either version 3 of the License, or
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
13 ;; (at your option) any later version.
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
14
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
19
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
22
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
23 ;;; Code:
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
24
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
25 (defgroup epa-file nil
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
26 "The EasyPG Assistant hooks for transparent file encryption"
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
27 :version "23.1"
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
28 :group 'epa)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
29
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
30 (defun epa-file--file-name-regexp-set (variable value)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
31 (set-default variable value)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
32 (if (fboundp 'epa-file-name-regexp-update)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
33 (epa-file-name-regexp-update)))
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
34
105870
26baacb565b0 * textmodes/tex-mode.el (tex-alt-dvi-print-command)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104990
diff changeset
35 (defcustom epa-file-name-regexp (purecopy "\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'")
94752
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
36 "Regexp which matches filenames to be encrypted with GnuPG.
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
37
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
38 If you set this outside Custom while epa-file is already enabled, you
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
39 have to call `epa-file-name-regexp-update' after setting it to
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
40 properly update file-name-handler-alist. Setting this through Custom
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
41 does that automatically."
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
42 :type 'regexp
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
43 :group 'epa-file
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
44 :set 'epa-file--file-name-regexp-set)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
45
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
46 (defcustom epa-file-inhibit-auto-save t
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
47 "If non-nil, disable auto-saving when opening an encrypted file."
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
48 :type 'boolean
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
49 :group 'epa-file)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
50
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
51 (defvar epa-file-encrypt-to nil
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
52 "*Recipient(s) used for encrypting files.
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
53 May either be a string or a list of strings.")
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
54
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
55 (put 'epa-file-encrypt-to 'safe-local-variable
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
56 (lambda (val)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
57 (or (stringp val)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
58 (and (listp val)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
59 (catch 'safe
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
60 (mapc (lambda (elt)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
61 (unless (stringp elt)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
62 (throw 'safe nil)))
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
63 val)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
64 t)))))
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
65
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
66 (put 'epa-file-encrypt-to 'permanent-local t)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
67
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
68 (defvar epa-file-handler
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
69 (cons epa-file-name-regexp 'epa-file-handler))
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
70
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
71 (defvar epa-file-auto-mode-alist-entry
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
72 (list epa-file-name-regexp nil 'epa-file))
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
73
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
74 (defun epa-file-name-regexp-update ()
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
75 (interactive)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
76 (unless (equal (car epa-file-handler) epa-file-name-regexp)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
77 (setcar epa-file-handler epa-file-name-regexp)))
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
78
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
79 (defun epa-file-find-file-hook ()
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
80 (if (and buffer-file-name
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
81 (string-match epa-file-name-regexp buffer-file-name)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
82 epa-file-inhibit-auto-save)
100304
4dfef179eed3 * epa-hook.el (epa-file-find-file-hook): Don't mark the current
Daiki Ueno <ueno@unixuser.org>
parents: 94758
diff changeset
83 (auto-save-mode 0)))
94752
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
84
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
85 (define-minor-mode auto-encryption-mode
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
86 "Toggle automatic file encryption and decryption.
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
87 With prefix argument ARG, turn auto encryption on if positive, else off.
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
88 Return the new status of auto encryption (non-nil means on)."
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
89 :global t :init-value t :group 'epa-file :version "23.1"
104990
f0794252d960 * mail/sendmail.el (send-mail-function):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 100908
diff changeset
90 ;; We'd like to use custom-initialize-set here so the setup is done
f0794252d960 * mail/sendmail.el (send-mail-function):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 100908
diff changeset
91 ;; before dumping, but at the point where the defcustom is evaluated,
f0794252d960 * mail/sendmail.el (send-mail-function):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 100908
diff changeset
92 ;; the corresponding function isn't defined yet, so
f0794252d960 * mail/sendmail.el (send-mail-function):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 100908
diff changeset
93 ;; custom-initialize-set signals an error.
f0794252d960 * mail/sendmail.el (send-mail-function):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 100908
diff changeset
94 :initialize 'custom-initialize-delay
94752
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
95 (setq file-name-handler-alist
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
96 (delq epa-file-handler file-name-handler-alist))
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
97 (remove-hook 'find-file-hooks 'epa-file-find-file-hook)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
98 (setq auto-mode-alist (delq epa-file-auto-mode-alist-entry
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
99 auto-mode-alist))
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
100 (when auto-encryption-mode
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
101 (setq file-name-handler-alist
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
102 (cons epa-file-handler file-name-handler-alist))
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
103 (add-hook 'find-file-hook 'epa-file-find-file-hook)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
104 (setq auto-mode-alist (cons epa-file-auto-mode-alist-entry
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
105 auto-mode-alist))))
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
106
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
107 (put 'epa-file-handler 'safe-magic t)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
108 (put 'epa-file-handler 'operations '(write-region insert-file-contents))
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
109
94755
14eda1195ec3 Provide/require epa-hook, not epa-file-hook.
Eli Zaretskii <eliz@gnu.org>
parents: 94752
diff changeset
110 (provide 'epa-hook)
94752
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
111
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
112 ;; arch-tag: f75c8a50-d32e-4eb3-9ec6-9e940c1fc8b5
94758
2b066c2202f5 Change file name on the last line.
Eli Zaretskii <eliz@gnu.org>
parents: 94755
diff changeset
113 ;;; epa-hook.el ends here