Mercurial > emacs
annotate lisp/epa-dired.el @ 92457:4889233e5713
*** empty log message ***
author | Jason Rumney <jasonr@gnu.org> |
---|---|
date | Mon, 03 Mar 2008 22:20:13 +0000 |
parents | 457a4ba95667 |
children | 1a8916b995cf |
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 | |
91787
457a4ba95667
EasyPG: Update manual, menu label, epa-menu-mode->epa-mode, dired minor mode.
Michael Olson <mwolson@gnu.org>
parents:
91731
diff
changeset
|
29 (defvar epa-dired-mode-map |
91647 | 30 (let ((keymap (make-sparse-keymap))) |
91787
457a4ba95667
EasyPG: Update manual, menu label, epa-menu-mode->epa-mode, dired minor mode.
Michael Olson <mwolson@gnu.org>
parents:
91731
diff
changeset
|
31 (define-key keymap ":d" 'epa-dired-do-decrypt) |
457a4ba95667
EasyPG: Update manual, menu label, epa-menu-mode->epa-mode, dired minor mode.
Michael Olson <mwolson@gnu.org>
parents:
91731
diff
changeset
|
32 (define-key keymap ":v" 'epa-dired-do-verify) |
457a4ba95667
EasyPG: Update manual, menu label, epa-menu-mode->epa-mode, dired minor mode.
Michael Olson <mwolson@gnu.org>
parents:
91731
diff
changeset
|
33 (define-key keymap ":s" 'epa-dired-do-sign) |
457a4ba95667
EasyPG: Update manual, menu label, epa-menu-mode->epa-mode, dired minor mode.
Michael Olson <mwolson@gnu.org>
parents:
91731
diff
changeset
|
34 (define-key keymap ":e" 'epa-dired-do-encrypt) |
91647 | 35 keymap)) |
36 | |
91787
457a4ba95667
EasyPG: Update manual, menu label, epa-menu-mode->epa-mode, dired minor mode.
Michael Olson <mwolson@gnu.org>
parents:
91731
diff
changeset
|
37 (defvar epa-dired-mode-hook nil) |
457a4ba95667
EasyPG: Update manual, menu label, epa-menu-mode->epa-mode, dired minor mode.
Michael Olson <mwolson@gnu.org>
parents:
91731
diff
changeset
|
38 (defvar epa-dired-mode-on-hook nil) |
457a4ba95667
EasyPG: Update manual, menu label, epa-menu-mode->epa-mode, dired minor mode.
Michael Olson <mwolson@gnu.org>
parents:
91731
diff
changeset
|
39 (defvar epa-dired-mode-off-hook nil) |
91647 | 40 |
91787
457a4ba95667
EasyPG: Update manual, menu label, epa-menu-mode->epa-mode, dired minor mode.
Michael Olson <mwolson@gnu.org>
parents:
91731
diff
changeset
|
41 ;;;###autoload |
457a4ba95667
EasyPG: Update manual, menu label, epa-menu-mode->epa-mode, dired minor mode.
Michael Olson <mwolson@gnu.org>
parents:
91731
diff
changeset
|
42 (define-minor-mode epa-dired-mode |
457a4ba95667
EasyPG: Update manual, menu label, epa-menu-mode->epa-mode, dired minor mode.
Michael Olson <mwolson@gnu.org>
parents:
91731
diff
changeset
|
43 "A minor-mode for encrypt/decrypt files with Dired." |
457a4ba95667
EasyPG: Update manual, menu label, epa-menu-mode->epa-mode, dired minor mode.
Michael Olson <mwolson@gnu.org>
parents:
91731
diff
changeset
|
44 nil " epa-dired" epa-dired-mode-map) |
91647 | 45 |
46 (defun epa-dired-do-decrypt () | |
47 "Decrypt marked files." | |
48 (interactive) | |
49 (let ((file-list (dired-get-marked-files))) | |
50 (while file-list | |
51 (epa-decrypt-file (expand-file-name (car file-list))) | |
52 (setq file-list (cdr file-list))) | |
53 (revert-buffer))) | |
54 | |
55 (defun epa-dired-do-verify () | |
56 "Verify marked files." | |
57 (interactive) | |
58 (let ((file-list (dired-get-marked-files))) | |
59 (while file-list | |
60 (epa-verify-file (expand-file-name (car file-list))) | |
61 (setq file-list (cdr file-list))))) | |
62 | |
63 (defun epa-dired-do-sign () | |
64 "Sign marked files." | |
65 (interactive) | |
66 (let ((file-list (dired-get-marked-files))) | |
67 (while file-list | |
68 (epa-sign-file | |
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. " | |
72 nil t) | |
73 (y-or-n-p "Make a detached signature? ")) | |
74 (setq file-list (cdr file-list))) | |
75 (revert-buffer))) | |
76 | |
77 (defun epa-dired-do-encrypt () | |
78 "Encrypt marked files." | |
79 (interactive) | |
80 (let ((file-list (dired-get-marked-files))) | |
81 (while file-list | |
82 (epa-encrypt-file | |
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))) | |
87 (revert-buffer))) | |
88 | |
91731
7efbdc83b944
EasyPG: Implement some suggestions from emacs-devel.
Michael Olson <mwolson@gnu.org>
parents:
91687
diff
changeset
|
89 ;;;###autoload |
91787
457a4ba95667
EasyPG: Update manual, menu label, epa-menu-mode->epa-mode, dired minor mode.
Michael Olson <mwolson@gnu.org>
parents:
91731
diff
changeset
|
90 (define-minor-mode epa-global-dired-mode |
91731
7efbdc83b944
EasyPG: Implement some suggestions from emacs-devel.
Michael Olson <mwolson@gnu.org>
parents:
91687
diff
changeset
|
91 "Minor mode to hook EasyPG into Dired." |
7efbdc83b944
EasyPG: Implement some suggestions from emacs-devel.
Michael Olson <mwolson@gnu.org>
parents:
91687
diff
changeset
|
92 :global t :init-value nil :group 'epa-dired :version "23.1" |
91787
457a4ba95667
EasyPG: Update manual, menu label, epa-menu-mode->epa-mode, dired minor mode.
Michael Olson <mwolson@gnu.org>
parents:
91731
diff
changeset
|
93 (remove-hook 'dired-mode-hook 'epa-dired-mode) |
457a4ba95667
EasyPG: Update manual, menu label, epa-menu-mode->epa-mode, dired minor mode.
Michael Olson <mwolson@gnu.org>
parents:
91731
diff
changeset
|
94 (if epa-global-dired-mode |
457a4ba95667
EasyPG: Update manual, menu label, epa-menu-mode->epa-mode, dired minor mode.
Michael Olson <mwolson@gnu.org>
parents:
91731
diff
changeset
|
95 (add-hook 'dired-mode-hook 'epa-dired-mode))) |
91731
7efbdc83b944
EasyPG: Implement some suggestions from emacs-devel.
Michael Olson <mwolson@gnu.org>
parents:
91687
diff
changeset
|
96 |
91647 | 97 (provide 'epa-dired) |
98 | |
91687 | 99 ;; arch-tag: 2025700b-48d0-4684-bc94-228ad1f8e9ff |
91647 | 100 ;;; epa-dired.el ends here |