annotate lisp/epa-dired.el @ 91654:3cd69d2e616a

Update license to GPLv3+.
author Glenn Morris <rgm@gnu.org>
date Fri, 08 Feb 2008 08:04:31 +0000
parents f9692dfe86e7
children d125b90283d2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
91647
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
1 ;;; epa-dired.el --- the EasyPG Assistant, dired extension
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
2 ;; Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
3
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
4 ;; Author: Daiki Ueno <ueno@unixuser.org>
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
5 ;; Keywords: PGP, GnuPG
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
6
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
8
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
91654
3cd69d2e616a Update license to GPLv3+.
Glenn Morris <rgm@gnu.org>
parents: 91647
diff changeset
11 ;; the Free Software Foundation; either version 3, or (at your option)
91647
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
12 ;; any later version.
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
13
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
17 ;; GNU General Public License for more details.
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
18
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
21 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
22 ;; Boston, MA 02110-1301, USA.
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
23
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
24 ;;; Code:
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
25
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
26 (require 'epa)
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
27 (require 'dired)
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
28
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
29 (defvar epa-dired-map
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
30 (let ((keymap (make-sparse-keymap)))
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
31 (define-key keymap "d" 'epa-dired-do-decrypt)
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
32 (define-key keymap "v" 'epa-dired-do-verify)
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
33 (define-key keymap "s" 'epa-dired-do-sign)
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
34 (define-key keymap "e" 'epa-dired-do-encrypt)
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
35 keymap))
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
36
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
37 (fset 'epa-dired-prefix epa-dired-map)
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
38
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
39 (defun epa-dired-mode-hook ()
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
40 (define-key dired-mode-map ":" 'epa-dired-prefix))
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
41
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
42 (defun epa-dired-do-decrypt ()
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
43 "Decrypt marked files."
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
44 (interactive)
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
45 (let ((file-list (dired-get-marked-files)))
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
46 (while file-list
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
47 (epa-decrypt-file (expand-file-name (car file-list)))
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
48 (setq file-list (cdr file-list)))
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
49 (revert-buffer)))
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
50
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
51 (defun epa-dired-do-verify ()
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
52 "Verify marked files."
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
53 (interactive)
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
54 (let ((file-list (dired-get-marked-files)))
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
55 (while file-list
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
56 (epa-verify-file (expand-file-name (car file-list)))
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
57 (setq file-list (cdr file-list)))))
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
58
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
59 (defun epa-dired-do-sign ()
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
60 "Sign marked files."
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
61 (interactive)
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
62 (let ((file-list (dired-get-marked-files)))
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
63 (while file-list
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
64 (epa-sign-file
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
65 (expand-file-name (car file-list))
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
66 (epa-select-keys (epg-make-context) "Select keys for signing.
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
67 If no one is selected, default secret key is used. "
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
68 nil t)
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
69 (y-or-n-p "Make a detached signature? "))
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
70 (setq file-list (cdr file-list)))
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
71 (revert-buffer)))
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
72
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
73 (defun epa-dired-do-encrypt ()
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
74 "Encrypt marked files."
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
75 (interactive)
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
76 (let ((file-list (dired-get-marked-files)))
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
77 (while file-list
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
78 (epa-encrypt-file
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
79 (expand-file-name (car file-list))
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
80 (epa-select-keys (epg-make-context) "Select recipents for encryption.
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
81 If no one is selected, symmetric encryption will be performed. "))
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
82 (setq file-list (cdr file-list)))
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
83 (revert-buffer)))
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
84
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
85 (provide 'epa-dired)
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
86
f9692dfe86e7 EasyPG: Initial check-in.
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
87 ;;; epa-dired.el ends here