1 ;;; epa-dired.el --- the EasyPG Assistant, dired extension
2 ;; Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
4 ;; Author: Daiki Ueno <ueno@unixuser.org>
5 ;; Keywords: PGP, GnuPG
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 3, or (at your option)
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 ;; Boston, MA 02110-1301, USA.
29 (defvar epa-dired-mode-map
30 (let ((keymap (make-sparse-keymap)))
31 (define-key keymap
":d" 'epa-dired-do-decrypt
)
32 (define-key keymap
":v" 'epa-dired-do-verify
)
33 (define-key keymap
":s" 'epa-dired-do-sign
)
34 (define-key keymap
":e" 'epa-dired-do-encrypt
)
37 (defvar epa-dired-mode-hook nil
)
38 (defvar epa-dired-mode-on-hook nil
)
39 (defvar epa-dired-mode-off-hook nil
)
42 (define-minor-mode epa-dired-mode
43 "A minor-mode for encrypt/decrypt files with Dired."
44 nil
" epa-dired" epa-dired-mode-map
)
46 (defun epa-dired-do-decrypt ()
47 "Decrypt marked files."
49 (let ((file-list (dired-get-marked-files)))
51 (epa-decrypt-file (expand-file-name (car file-list
)))
52 (setq file-list
(cdr file-list
)))
55 (defun epa-dired-do-verify ()
56 "Verify marked files."
58 (let ((file-list (dired-get-marked-files)))
60 (epa-verify-file (expand-file-name (car file-list
)))
61 (setq file-list
(cdr file-list
)))))
63 (defun epa-dired-do-sign ()
66 (let ((file-list (dired-get-marked-files)))
69 (expand-file-name (car file-list
))
70 (epa-select-keys (epg-make-context) "Select keys for signing.
71 If no one is selected, default secret key is used. "
73 (y-or-n-p "Make a detached signature? "))
74 (setq file-list
(cdr file-list
)))
77 (defun epa-dired-do-encrypt ()
78 "Encrypt marked files."
80 (let ((file-list (dired-get-marked-files)))
83 (expand-file-name (car file-list
))
84 (epa-select-keys (epg-make-context) "Select recipents for encryption.
85 If no one is selected, symmetric encryption will be performed. "))
86 (setq file-list
(cdr file-list
)))
90 (define-minor-mode epa-global-dired-mode
91 "Minor mode to hook EasyPG into Dired."
92 :global t
:init-value nil
:group
'epa-dired
:version
"23.1"
93 (remove-hook 'dired-mode-hook
'epa-dired-mode
)
94 (if epa-global-dired-mode
95 (add-hook 'dired-mode-hook
'epa-dired-mode
)))
99 ;; arch-tag: 2025700b-48d0-4684-bc94-228ad1f8e9ff
100 ;;; epa-dired.el ends here