]> git.eshelyaron.com Git - emacs.git/commitdiff
EasyPG: Implement some suggestions from emacs-devel.
authorMichael Olson <mwolson@gnu.org>
Sun, 10 Feb 2008 20:57:47 +0000 (20:57 +0000)
committerMichael Olson <mwolson@gnu.org>
Sun, 10 Feb 2008 20:57:47 +0000 (20:57 +0000)
doc/misc/ChangeLog
doc/misc/epa.texi
lisp/ChangeLog
lisp/epa-dired.el
lisp/epa-file.el
lisp/epa-mail.el
lisp/epa.el
lisp/epg-config.el
lisp/epg.el

index 005728ae4ba6294da8776c6628426b93330c1a70..f88471754cb8e5c08b8c7dfec0a363265eb151e9 100644 (file)
@@ -1,3 +1,8 @@
+2008-02-10  Daiki Ueno  <ueno@unixuser.org>
+
+       * epa.texi (Quick start): Use the command `epa-enable' instead of
+       loading `epa-setup'.
+
 2008-02-08  Juanma Barranquero  <lekktu@gmail.com>
 
        * makefile.w32-in (INFO_TARGETS, DVI_TARGETS, clean): Add epa.
index f47f5c2921f79c7afa5f4fff342a1edbca879b8e..08f3fb4178b0ec8a0c76af699d30cd1f24d61e26 100644 (file)
@@ -77,26 +77,28 @@ EasyPG Assistant provides the following features.
 @node  Quick start
 @chapter Quick start
 
-To install, just follow the standard CMMI installation instructions.
+@c To install, just follow the standard CMMI installation instructions.
 
-@cartouche
-@example
-$ ./configure
-$ sudo make install
-@end example
-@end cartouche
+@c @cartouche
+@c @example
+@c $ ./configure
+@c $ sudo make install
+@c @end example
+@c @end cartouche
 
-@noindent
-Then, add the following line to your @file{~/.emacs}
+@c @noindent
+@c Then, add the following line to your @file{~/.emacs}
+
+Add the following line to your @file{~/.emacs}.
 
 @cartouche
 @lisp
-(require 'epa-setup)
+(epa-mode 1)
 @end lisp
 @end cartouche
 
 @noindent
-That's all.  Restart emacs and type @kbd{M-x epa- @key{TAB}}, and you will see a
+Restart emacs and type @kbd{M-x epa- @key{TAB}}, and you will see a
 lot of commands available.  For example,
 
 @itemize @bullet
index f2c662e03c7ca4fd902966e3b28f8c9a966e20db..c19e27d04db13ba6648610c7b7bdfcbf41fafed6 100644 (file)
@@ -1,3 +1,23 @@
+2008-02-10  Daiki Ueno  <ueno@unixuser.org>
+
+       * epg-config.el: Expand the contents of epg-package-info.el.
+       (epg-package-name): New constant.
+       (epg-version-number): New constant.
+       (epg-bug-report-address): New constant.
+
+       * epa-mail.el (epa-mail-mode): Add autoload cookie.
+       (epa-mail-minor-mode): New global minor mode.
+
+       * epa-file.el (epa-file-mode): New global minor mode.
+
+       * epa-dired.el (epa-dired-mode): New global minor mode.
+
+       * epa.el (epa-menu): New variable.
+       (epa-menu-items): New variable.
+       (epa-menu-mode): New global minor mode.
+       (epa-global-minor-modes): New user option.
+       (epa-mode): New global minor mode.
+
 2008-02-10  Michael Albinus  <michael.albinus@gmx.de>
 
        * net/dbus.el: Remove `no-byte-compile' cookie.
index 945dd97b7672c50c8e133569b0fb4821a7b9d04d..ab0bf7d92a22bd4554554a5b008818f8e83fe2ef 100644 (file)
@@ -82,6 +82,14 @@ If no one is selected, symmetric encryption will be performed.  "))
       (setq file-list (cdr file-list)))
     (revert-buffer)))
 
+;;;###autoload
+(define-minor-mode epa-dired-mode
+  "Minor mode to hook EasyPG into Dired."
+  :global t :init-value nil :group 'epa-dired :version "23.1"
+  (remove-hook 'dired-mode-hook 'epa-dired-mode-hook)
+  (if epa-dired-mode
+      (add-hook 'dired-mode-hook 'epa-dired-mode-hook)))
+
 (provide 'epa-dired)
 
 ;; arch-tag: 2025700b-48d0-4684-bc94-228ad1f8e9ff
index c753d4c37a0f441d400d257e6b112b461adc3205..e3c4a83deb8689d37ae061a1a7f76fe2f23904fd 100644 (file)
@@ -314,6 +314,24 @@ If no one is selected, symmetric encryption will be performed.  ")))
        (message "`epa-file' disabled"))
     (message "`epa-file' already disabled")))
 
+;;;###autoload
+(define-minor-mode epa-file-mode
+  "Toggle automatic file encryption and decryption.
+With prefix argument ARG, turn auto encryption on if positive, else off.
+Return the new status of auto encryption (non-nil means on)."
+  :global t :init-value nil :group 'epa-file :version "23.1"
+  (setq file-name-handler-alist
+       (delq epa-file-handler file-name-handler-alist))
+  (remove-hook 'find-file-hooks 'epa-file-find-file-hook)
+  (setq auto-mode-alist (delq epa-file-auto-mode-alist-entry
+                             auto-mode-alist))
+  (when epa-file-mode
+    (setq file-name-handler-alist
+         (cons epa-file-handler file-name-handler-alist))
+    (add-hook 'find-file-hooks 'epa-file-find-file-hook)
+    (setq auto-mode-alist (cons epa-file-auto-mode-alist-entry
+                               auto-mode-alist))))
+
 (provide 'epa-file)
 
 ;; arch-tag: 5715152f-0eb1-4dbc-9008-07098775314d
index d1f1d3b5295be615619df96776e94115f5070976..0fcff2806cab8ca58e64a5db13062f4a9c93088c 100644 (file)
@@ -40,6 +40,7 @@
 (defvar epa-mail-mode-on-hook nil)
 (defvar epa-mail-mode-off-hook nil)
 
+;;;###autoload
 (define-minor-mode epa-mail-mode
   "A minor-mode for composing encrypted/clearsigned mails."
   nil " epa-mail" epa-mail-mode-map)
@@ -173,6 +174,14 @@ Don't use this command in Lisp programs!"
   (interactive)
   (epa-import-armor-in-region (point-min) (point-max)))
 
+;;;###autoload
+(define-minor-mode epa-mail-minor-mode
+  "Minor mode to hook EasyPG into Mail mode."
+  :global t :init-value nil :group 'epa-mail :version "23.1"
+  (remove-hook 'mail-mode-hook 'epa-mail-mode)
+  (if epa-mail-minor-mode
+      (add-hook 'mail-mode-hook 'epa-mail-mode)))
+
 (provide 'epa-mail)
 
 ;; arch-tag: a6f82b3f-d177-4a11-af95-040da55927d2
index ea1c4aad593b64c294319042460f363af44dcf06..5d40a6345a0535b9254858b768e9776189c215ab 100644 (file)
@@ -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
index 1ac05d1ba52691da0c22bccca652d50ee8942451..f3dc9469564a9ea598761dcfafbda226ce396329 100644 (file)
 
 ;;; Code:
 
-(require 'epg-package-info)
+(defconst epg-package-name "epg"
+  "Name of this package.")
+
+(defconst epg-version-number "1.0.0"
+  "Version number of this package.")
+
+(defconst epg-bug-report-address "ueno@unixuser.org"
+  "Report bugs to this address.")
 
 (defgroup epg ()
   "The EasyPG Library"
index 4e6824ac9e047180f7d9285d39f78fad1576c18f..cc07d6201d60e970dbba5b0e5ff816489ae6781a 100644 (file)
@@ -1430,7 +1430,7 @@ This function is for internal use only."
        signature
        (string-to-number (match-string 4 string)))
       (epg-signature-set-pubkey-algorithm
-       signature 
+       signature
        (string-to-number (match-string 5 string)))
       (epg-signature-set-digest-algorithm
        signature
@@ -1744,7 +1744,7 @@ This function is for internal use only."
 (defun epg-list-keys (context &optional name mode)
   "Return a list of epg-key objects matched with NAME.
 If MODE is nil or 'public, only public keyring should be searched.
-If MODE is t or 'secret, only secret keyring should be searched. 
+If MODE is t or 'secret, only secret keyring should be searched.
 Otherwise, only public keyring should be searched and the key
 signatures should be included.
 NAME is either a string or a list of strings."