summaryrefslogtreecommitdiff
path: root/lisp/epa.el
diff options
context:
space:
mode:
authorMichael Olson <mwolson@gnu.org>2008-02-10 20:57:47 +0000
committerMichael Olson <mwolson@gnu.org>2008-02-10 20:57:47 +0000
commitf1914c4078082de71933f6cdf7735411e488d045 (patch)
treecfb6b673ff2bb8fdd02e1a5aa7b7e5e96c0d6f18 /lisp/epa.el
parentc6588a85bcb0bdcd615f4f34496d71943120e7ae (diff)
downloademacs-f1914c4078082de71933f6cdf7735411e488d045.tar.gz
EasyPG: Implement some suggestions from emacs-devel.
Diffstat (limited to 'lisp/epa.el')
-rw-r--r--lisp/epa.el74
1 files changed, 73 insertions, 1 deletions
diff --git a/lisp/epa.el b/lisp/epa.el
index ea1c4aad593..5d40a6345a0 100644
--- a/lisp/epa.el
+++ b/lisp/epa.el
@@ -45,6 +45,14 @@ the separate window."
:type 'integer
:group 'epa)
+(defcustom epa-global-minor-modes '(epa-dired-mode
+ epa-file-mode
+ epa-mail-minor-mode
+ epa-menu-mode)
+ "Globally defined minor modes to hook into other modes."
+ :type '(repeat symbol)
+ :group 'epa)
+
(defgroup epa-faces nil
"Faces for epa-mode."
:version "23.1"
@@ -229,6 +237,44 @@ You should bind this variable with `let', but do not set it globally.")
(define-key keymap "q" 'delete-window)
keymap))
+(defvar epa-menu nil)
+
+(defconst epa-menu-items
+ '("EasyPG Assistant"
+ ("Decrypt"
+ ["File" epa-decrypt-file
+ :help "Decrypt a file"]
+ ["Region" epa-decrypt-region
+ :help "Decrypt the current region"])
+ ("Verify"
+ ["File" epa-verify-file
+ :help "Verify digital signature of a file"]
+ ["Region" epa-verify-region
+ :help "Verify digital signature of the current region"])
+ ("Sign"
+ ["File" epa-sign-file
+ :help "Create digital signature of a file"]
+ ["Region" epa-sign-region
+ :help "Create digital signature of the current region"])
+ ("Encrypt"
+ ["File" epa-encrypt-file
+ :help "Encrypt a file"]
+ ["Region" epa-encrypt-region
+ :help "Encrypt the current region"])
+ "----"
+ ["Browse keyring" epa-list-keys
+ :help "Browse your public keyring"]
+ ("Import keys"
+ ["File" epa-import-keys
+ :help "Import public keys from a file"]
+ ["Region" epa-import-keys-region
+ :help "Import public keys from the current region"])
+ ("Export key"
+ ["To a File" epa-export-keys
+ :help "Export public keys to a file"]
+ ["To a Buffer" epa-insert-keys
+ :help "Insert public keys after the current point"])))
+
(defvar epa-exit-buffer-function #'bury-buffer)
(define-widget 'epa-key 'push-button
@@ -372,7 +418,7 @@ If ARG is non-nil, mark the key."
'end-open t))
(widget-create 'epa-key :value (car keys))
(insert "\n")
- (setq keys (cdr keys))))
+ (setq keys (cdr keys))))
(add-text-properties (point-min) (point-max)
(list 'epa-list-keys t
'front-sticky nil
@@ -1173,6 +1219,32 @@ Don't use this command in Lisp programs!"
;; (message "Signing keys...done")))
;; (make-obsolete 'epa-sign-keys "Do not use.")
+;;;###autoload
+(define-minor-mode epa-menu-mode
+ "Minor mode to hook EasyPG into the menu-bar."
+ :global t :init-value nil :group 'epa :version "23.1"
+ (unless epa-menu
+ (easy-menu-define epa-menu nil "EasyPG Assistant global menu"
+ epa-menu-items))
+ (easy-menu-remove-item nil '("Tools") "EasyPG Assistant")
+ (if epa-menu-mode
+ (easy-menu-add-item nil '("Tools") epa-menu)))
+
+;;;###autoload
+(define-minor-mode epa-mode
+ "Minor mode to hook EasyPG into various modes.
+See `epa-global-minor-modes'."
+ :global t :init-value nil :group 'epa :version "23.1"
+ (let ((modes epa-global-minor-modes)
+ symbol)
+ (while modes
+ (setq symbol (car modes))
+ (if (and symbol
+ (fboundp symbol))
+ (funcall symbol (if epa-mode 1 0))
+ (message "`%S' not found" (car modes)))
+ (setq modes (cdr modes)))))
+
(provide 'epa)
;; arch-tag: 38d20ced-20d5-4137-b17a-f206335423d7