annotate lisp/epa-hook.el @ 112255:f6386067f593

Distinguish between terminfo and termcap on NetBSD (Bug#7642). * configure.in [netbsd systems]: Check for tputs definition. * src/config.in (TERMINFO): New definition. * src/s/netbsd.h: Use it to choose between terminfo and termcap.
author Chong Yidong <cyd@stupidchicken.com>
date Tue, 11 Jan 2011 21:29:23 -0500
parents 376148b31b5e
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
112218
376148b31b5e Add 2011 to FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
2 ;; Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 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
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
6
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
7 ;; 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
8
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
9 ;; 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
10 ;; 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
11 ;; 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
12 ;; (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
13
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
14 ;; 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
15 ;; 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
16 ;; 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
17 ;; 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
18
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
19 ;; 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
20 ;; 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
21
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
22 ;;; Code:
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
23
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
24 (defgroup epa-file nil
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
25 "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
26 :version "23.1"
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
27 :group 'epa)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
28
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
29 (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
30 (set-default variable value)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
31 (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
32 (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
105870
26baacb565b0 * textmodes/tex-mode.el (tex-alt-dvi-print-command)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104990
diff changeset
34 (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
35 "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
36
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
37 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
38 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
39 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
40 does that automatically."
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
41 :type 'regexp
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
42 :group 'epa-file
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
43 :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
44
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
45 (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
46 "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
47 :type 'boolean
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
48 :group 'epa-file)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
49
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
50 (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
51 "*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
52 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
53
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
54 (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
55 (lambda (val)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
56 (or (stringp val)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
57 (and (listp val)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
58 (catch 'safe
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
59 (mapc (lambda (elt)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
60 (unless (stringp elt)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
61 (throw 'safe nil)))
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
62 val)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
63 t)))))
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
64
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
65 (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
66
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
67 (defvar epa-file-handler
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
68 (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
69
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
70 (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
71 (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
72
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
73 (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
74 (interactive)
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
75 (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
76 (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
77
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
78 (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
79 (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
80 (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
81 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
82 (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
83
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
84 (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
85 "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
86 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
87 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
88 :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
89 ;; 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
90 ;; 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
91 ;; 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
92 ;; custom-initialize-set signals an error.
f0794252d960 * mail/sendmail.el (send-mail-function):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 100908
diff changeset
93 :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
94 (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
95 (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
96 (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
97 (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
98 auto-mode-alist))
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
99 (when auto-encryption-mode
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
100 (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
101 (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
102 (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
103 (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
104 auto-mode-alist))))
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
105
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
106 (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
107 (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
108
94755
14eda1195ec3 Provide/require epa-hook, not epa-file-hook.
Eli Zaretskii <eliz@gnu.org>
parents: 94752
diff changeset
109 (provide 'epa-hook)
94752
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
110
73a86a36a458 Renamed lisp/epa-file-hook.el to lisp/epa-hook.el.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
111 ;; 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
112 ;;; epa-hook.el ends here