diff options
author | Michael Olson <mwolson@gnu.org> | 2008-02-08 06:54:27 +0000 |
---|---|---|
committer | Michael Olson <mwolson@gnu.org> | 2008-02-08 06:54:27 +0000 |
commit | c154c0be0459b3ff6449be0b2993fd77d7fbb1c7 (patch) | |
tree | e4108eded300caaf19456a1f5b385d6a59a7ecbf /lisp/epa-dired.el | |
parent | 1752e20580918ecec926dd9a42d07647aaad60da (diff) | |
download | emacs-c154c0be0459b3ff6449be0b2993fd77d7fbb1c7.tar.gz emacs-c154c0be0459b3ff6449be0b2993fd77d7fbb1c7.tar.bz2 emacs-c154c0be0459b3ff6449be0b2993fd77d7fbb1c7.zip |
EasyPG: Initial check-in.
Diffstat (limited to 'lisp/epa-dired.el')
-rw-r--r-- | lisp/epa-dired.el | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/lisp/epa-dired.el b/lisp/epa-dired.el new file mode 100644 index 00000000000..b20218b0ff3 --- /dev/null +++ b/lisp/epa-dired.el @@ -0,0 +1,87 @@ +;;; epa-dired.el --- the EasyPG Assistant, dired extension +;; Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. + +;; Author: Daiki Ueno <ueno@unixuser.org> +;; Keywords: PGP, GnuPG + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Code: + +(require 'epa) +(require 'dired) + +(defvar epa-dired-map + (let ((keymap (make-sparse-keymap))) + (define-key keymap "d" 'epa-dired-do-decrypt) + (define-key keymap "v" 'epa-dired-do-verify) + (define-key keymap "s" 'epa-dired-do-sign) + (define-key keymap "e" 'epa-dired-do-encrypt) + keymap)) + +(fset 'epa-dired-prefix epa-dired-map) + +(defun epa-dired-mode-hook () + (define-key dired-mode-map ":" 'epa-dired-prefix)) + +(defun epa-dired-do-decrypt () + "Decrypt marked files." + (interactive) + (let ((file-list (dired-get-marked-files))) + (while file-list + (epa-decrypt-file (expand-file-name (car file-list))) + (setq file-list (cdr file-list))) + (revert-buffer))) + +(defun epa-dired-do-verify () + "Verify marked files." + (interactive) + (let ((file-list (dired-get-marked-files))) + (while file-list + (epa-verify-file (expand-file-name (car file-list))) + (setq file-list (cdr file-list))))) + +(defun epa-dired-do-sign () + "Sign marked files." + (interactive) + (let ((file-list (dired-get-marked-files))) + (while file-list + (epa-sign-file + (expand-file-name (car file-list)) + (epa-select-keys (epg-make-context) "Select keys for signing. +If no one is selected, default secret key is used. " + nil t) + (y-or-n-p "Make a detached signature? ")) + (setq file-list (cdr file-list))) + (revert-buffer))) + +(defun epa-dired-do-encrypt () + "Encrypt marked files." + (interactive) + (let ((file-list (dired-get-marked-files))) + (while file-list + (epa-encrypt-file + (expand-file-name (car file-list)) + (epa-select-keys (epg-make-context) "Select recipents for encryption. +If no one is selected, symmetric encryption will be performed. ")) + (setq file-list (cdr file-list))) + (revert-buffer))) + +(provide 'epa-dired) + +;;; epa-dired.el ends here |