Mercurial > emacs
annotate lisp/epa-dired.el @ 91774:47c48e8e3205
(read_key_sequence): Don't pass args with side effects to AREF,
it fails when compiling with -DENABLE_CHECKING.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Mon, 11 Feb 2008 11:29:41 +0000 |
parents | 7efbdc83b944 |
children | 457a4ba95667 |
rev | line source |
---|---|
91647 | 1 ;;; epa-dired.el --- the EasyPG Assistant, dired extension |
2 ;; Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. | |
3 | |
4 ;; Author: Daiki Ueno <ueno@unixuser.org> | |
5 ;; Keywords: PGP, GnuPG | |
6 | |
7 ;; This file is part of GNU Emacs. | |
8 | |
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 | |
91654 | 11 ;; the Free Software Foundation; either version 3, or (at your option) |
91647 | 12 ;; any later version. |
13 | |
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. | |
18 | |
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. | |
23 | |
24 ;;; Code: | |
25 | |
26 (require 'epa) | |
27 (require 'dired) | |
28 | |
29 (defvar epa-dired-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) | |
35 keymap)) | |
36 | |
37 (fset 'epa-dired-prefix epa-dired-map) | |
38 | |
39 (defun epa-dired-mode-hook () | |
40 (define-key dired-mode-map ":" 'epa-dired-prefix)) | |
41 | |
42 (defun epa-dired-do-decrypt () | |
43 "Decrypt marked files." | |
44 (interactive) | |
45 (let ((file-list (dired-get-marked-files))) | |
46 (while file-list | |
47 (epa-decrypt-file (expand-file-name (car file-list))) | |
48 (setq file-list (cdr file-list))) | |
49 (revert-buffer))) | |
50 | |
51 (defun epa-dired-do-verify () | |
52 "Verify marked files." | |
53 (interactive) | |
54 (let ((file-list (dired-get-marked-files))) | |
55 (while file-list | |
56 (epa-verify-file (expand-file-name (car file-list))) | |
57 (setq file-list (cdr file-list))))) | |
58 | |
59 (defun epa-dired-do-sign () | |
60 "Sign marked files." | |
61 (interactive) | |
62 (let ((file-list (dired-get-marked-files))) | |
63 (while file-list | |
64 (epa-sign-file | |
65 (expand-file-name (car file-list)) | |
66 (epa-select-keys (epg-make-context) "Select keys for signing. | |
67 If no one is selected, default secret key is used. " | |
68 nil t) | |
69 (y-or-n-p "Make a detached signature? ")) | |
70 (setq file-list (cdr file-list))) | |
71 (revert-buffer))) | |
72 | |
73 (defun epa-dired-do-encrypt () | |
74 "Encrypt marked files." | |
75 (interactive) | |
76 (let ((file-list (dired-get-marked-files))) | |
77 (while file-list | |
78 (epa-encrypt-file | |
79 (expand-file-name (car file-list)) | |
80 (epa-select-keys (epg-make-context) "Select recipents for encryption. | |
81 If no one is selected, symmetric encryption will be performed. ")) | |
82 (setq file-list (cdr file-list))) | |
83 (revert-buffer))) | |
84 | |
91731
7efbdc83b944
EasyPG: Implement some suggestions from emacs-devel.
Michael Olson <mwolson@gnu.org>
parents:
91687
diff
changeset
|
85 ;;;###autoload |
7efbdc83b944
EasyPG: Implement some suggestions from emacs-devel.
Michael Olson <mwolson@gnu.org>
parents:
91687
diff
changeset
|
86 (define-minor-mode epa-dired-mode |
7efbdc83b944
EasyPG: Implement some suggestions from emacs-devel.
Michael Olson <mwolson@gnu.org>
parents:
91687
diff
changeset
|
87 "Minor mode to hook EasyPG into Dired." |
7efbdc83b944
EasyPG: Implement some suggestions from emacs-devel.
Michael Olson <mwolson@gnu.org>
parents:
91687
diff
changeset
|
88 :global t :init-value nil :group 'epa-dired :version "23.1" |
7efbdc83b944
EasyPG: Implement some suggestions from emacs-devel.
Michael Olson <mwolson@gnu.org>
parents:
91687
diff
changeset
|
89 (remove-hook 'dired-mode-hook 'epa-dired-mode-hook) |
7efbdc83b944
EasyPG: Implement some suggestions from emacs-devel.
Michael Olson <mwolson@gnu.org>
parents:
91687
diff
changeset
|
90 (if epa-dired-mode |
7efbdc83b944
EasyPG: Implement some suggestions from emacs-devel.
Michael Olson <mwolson@gnu.org>
parents:
91687
diff
changeset
|
91 (add-hook 'dired-mode-hook 'epa-dired-mode-hook))) |
7efbdc83b944
EasyPG: Implement some suggestions from emacs-devel.
Michael Olson <mwolson@gnu.org>
parents:
91687
diff
changeset
|
92 |
91647 | 93 (provide 'epa-dired) |
94 | |
91687 | 95 ;; arch-tag: 2025700b-48d0-4684-bc94-228ad1f8e9ff |
91647 | 96 ;;; epa-dired.el ends here |