Add new error and function `user-error'.
[emacs.git] / lisp / epa-dired.el
bloba79b471f06b415791cb746568b6d0af13c92c076
1 ;;; epa-dired.el --- the EasyPG Assistant, dired extension -*- lexical-binding: t -*-
2 ;; Copyright (C) 2006-2012 Free Software Foundation, Inc.
4 ;; Author: Daiki Ueno <ueno@unixuser.org>
5 ;; Keywords: PGP, GnuPG
6 ;; Package: epa
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
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.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
23 ;;; Code:
25 (require 'epa)
26 (require 'dired)
28 ;;;###autoload
29 (defun epa-dired-do-decrypt ()
30 "Decrypt marked files."
31 (interactive)
32 (let ((file-list (dired-get-marked-files)))
33 (while file-list
34 (epa-decrypt-file (expand-file-name (car file-list)))
35 (setq file-list (cdr file-list)))
36 (revert-buffer)))
38 ;;;###autoload
39 (defun epa-dired-do-verify ()
40 "Verify marked files."
41 (interactive)
42 (let ((file-list (dired-get-marked-files)))
43 (while file-list
44 (epa-verify-file (expand-file-name (car file-list)))
45 (setq file-list (cdr file-list)))))
47 ;;;###autoload
48 (defun epa-dired-do-sign ()
49 "Sign marked files."
50 (interactive)
51 (let ((file-list (dired-get-marked-files)))
52 (while file-list
53 (epa-sign-file
54 (expand-file-name (car file-list))
55 (epa-select-keys (epg-make-context) "Select keys for signing.
56 If no one is selected, default secret key is used. "
57 nil t)
58 (y-or-n-p "Make a detached signature? "))
59 (setq file-list (cdr file-list)))
60 (revert-buffer)))
62 ;;;###autoload
63 (defun epa-dired-do-encrypt ()
64 "Encrypt marked files."
65 (interactive)
66 (let ((file-list (dired-get-marked-files)))
67 (while file-list
68 (epa-encrypt-file
69 (expand-file-name (car file-list))
70 (epa-select-keys (epg-make-context) "Select recipients for encryption.
71 If no one is selected, symmetric encryption will be performed. "))
72 (setq file-list (cdr file-list)))
73 (revert-buffer)))
75 (provide 'epa-dired)
77 ;;; epa-dired.el ends here