emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: patch to include EasyPG to Emacs


From: Daiki Ueno
Subject: Re: patch to include EasyPG to Emacs
Date: Sun, 10 Feb 2008 16:04:05 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Michael Olson <address@hidden> writes:

>> I believe that all the copyright issues of EasyPG were solved now and
>> EasyPG is ready to be installed.  The following is a preliminary patch
>> to the trunk: http://www.easypg.org/add-epg-to-emacs.diff.gz
>
> I've checked in this patch, with the following changes.

Thanks.  (I'm sorry for that I sent a previous reply to you without
Cc-ing the ML by mistake).

> Here are some minor things I've noticed which could possibly need some
> changes made.
>
>  - epg-package-info.el is very small.  Perhaps it should be merged with
>    epg.el.
>  - epa-setup.el is also small.  It might be best to:
>    - Remove the autoload for epa-list-keys.
>    - Add an ;;;###autoload tag for epa-dired-mode-hook.
>    - Add an ;;;###autoload tag for epa-mail-mode.
>    - Move most of the remainder into a function called `epa-setup' (or
>      something similar).  That function could take an optional argument
>      which if positive or t would enable this functionality, or if
>      negative would disable it (remove-hook, call epa-file-disable,
>      etc.).
>  - Several of these files have trailing whitespace.  Once the initial
>    flurry of changes has been made, these should be dealt with.

The attached patch will fix them.  It does:

- merge epg-package-info.el into epg-config.el,
- add autoload cookies for epa-dired-mode-hook and epa-mail-mode,
- provide epa-*-enable/disable commands for several "intrusive" features for
  other modes (dired, mail-mode, menu-bars),
- replace (require 'epa-setup) with (epa-enable),
- remove trailing whitespaces,
- define menus, and
- clarify EasyPG functionalities in NEWS.

After applying this patch, epg-package-info.el and epa-setup.el can be
safely removed.

Index: doc/misc/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/doc/misc/ChangeLog,v
retrieving revision 1.90
diff -c -r1.90 ChangeLog
*** doc/misc/ChangeLog  8 Feb 2008 10:20:27 -0000       1.90
--- doc/misc/ChangeLog  10 Feb 2008 07:02:30 -0000
***************
*** 1,3 ****
--- 1,8 ----
+ 2008-02-10  Daiki Ueno  <address@hidden>
+ 
+       * epa.texi (Quick start): Use the command `epa-enable' instead of
+       loading `epa-setup'.
+ 
  2008-02-08  Juanma Barranquero  <address@hidden>
  
        * makefile.w32-in (INFO_TARGETS, DVI_TARGETS, clean): Add epa.
Index: doc/misc/epa.texi
===================================================================
RCS file: /sources/emacs/emacs/doc/misc/epa.texi,v
retrieving revision 1.2
diff -c -r1.2 epa.texi
*** doc/misc/epa.texi   9 Feb 2008 02:29:01 -0000       1.2
--- doc/misc/epa.texi   10 Feb 2008 07:02:30 -0000
***************
*** 77,97 ****
  @node  Quick start
  @chapter Quick start
  
! To install, just follow the standard CMMI installation instructions.
  
! @cartouche
! @example
! $ ./configure
! $ sudo make install
! @end example
! @end cartouche
  
! @noindent
! Then, add the following line to your @file{~/.emacs}
  
  @cartouche
  @lisp
! (require 'epa-setup)
  @end lisp
  @end cartouche
  
--- 77,99 ----
  @node  Quick start
  @chapter Quick start
  
! @c To install, just follow the standard CMMI installation instructions.
  
! @c @cartouche
! @c @example
! @c $ ./configure
! @c $ sudo make install
! @c @end example
! @c @end cartouche
  
! @c @noindent
! @c Then, add the following line to your @file{~/.emacs}
! 
! Add the following line to your @file{~/.emacs}.
  
  @cartouche
  @lisp
! (epa-enable)
  @end lisp
  @end cartouche
  
Index: etc/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/etc/ChangeLog,v
retrieving revision 1.678
diff -c -r1.678 ChangeLog
*** etc/ChangeLog       8 Feb 2008 08:57:40 -0000       1.678
--- etc/ChangeLog       10 Feb 2008 07:02:30 -0000
***************
*** 1,3 ****
--- 1,7 ----
+ 2008-02-10  Daiki Ueno  <address@hidden>
+ 
+       * NEWS: Clarify EasyPG functionalities.
+ 
  2008-02-08  Jan Djärv  <address@hidden>
  
        * NEWS: Mention XEmbed and --parent-id.
Index: etc/NEWS
===================================================================
RCS file: /sources/emacs/emacs/etc/NEWS,v
retrieving revision 1.1652
diff -c -r1.1652 NEWS
*** etc/NEWS    10 Feb 2008 02:06:57 -0000      1.1652
--- etc/NEWS    10 Feb 2008 07:02:31 -0000
***************
*** 242,254 ****
  inter-process communication mechanism for applications residing on the
  same host, based on messages.  See the manual for further details.
  
! ** EasyPG is now part of the Emacs distribution.
! EasyPG is an all-in-one GnuPG interface for Emacs. It consists of two
! parts: EasyPG Assistant and EasyPG Library.
! 
! EasyPG Assistant is a set of convenient tools to use GnuPG from
! Emacs. EasyPG Library is a sort of an elisp port of GPGME, a wrapper
! library which provides API to access some of the GnuPG functions.

  * Changes in Specialized Modes and Packages in Emacs 23.1
  
--- 242,251 ----
  inter-process communication mechanism for applications residing on the
  same host, based on messages.  See the manual for further details.
  
! ** EasyPG is now part of the Emacs distribution.  It is an all-in-one
! GnuPG interface which includes GnuPG keyring browser, cryptographic
! operations on regions and files, and automatic encryption of *.gpg
! files.  See the EasyPG Assistant User's Manual for further details.

  * Changes in Specialized Modes and Packages in Emacs 23.1
  
Index: lisp/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.12749
diff -c -r1.12749 ChangeLog
*** lisp/ChangeLog      9 Feb 2008 23:15:54 -0000       1.12749
--- lisp/ChangeLog      10 Feb 2008 07:02:33 -0000
***************
*** 1,3 ****
--- 1,26 ----
+ 2008-02-10  Daiki Ueno  <address@hidden>
+ 
+       * 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-enable): New command.
+       (epa-mail-disable): New command.
+ 
+       * epa-dired.el (epa-dired-mode-hook): Add autoload cookie.
+       (epa-dired-enable): New command.
+       (epa-dired-disable): New command.
+ 
+       * epa.el (epa-menu): New variable.
+       (epa-menu-items): New variable.
+       (epa-menu-enable): New command.
+       (epa-menu-disable): New command.
+       (epa-features): New user option.
+       (epa-enable): New command.
+       (epa-disable): New command.
+ 
  2008-02-09  Jason Rumney  <address@hidden>
  
        * button.el (button-map):
Index: lisp/epa-dired.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/epa-dired.el,v
retrieving revision 1.3
diff -c -r1.3 epa-dired.el
*** lisp/epa-dired.el   9 Feb 2008 02:29:01 -0000       1.3
--- lisp/epa-dired.el   10 Feb 2008 07:02:33 -0000
***************
*** 82,87 ****
--- 82,106 ----
        (setq file-list (cdr file-list)))
      (revert-buffer)))
  
+ ;;;###autoload
+ (defun epa-dired-enable ()
+   (interactive)
+   (if (and (boundp 'dired-mode-hook)
+          (memq 'epa-dired-mode-hook dired-mode-hook))
+       (message "`epa-dired' already enabled")
+     (add-hook 'dired-mode-hook 'epa-dired-mode-hook)
+     (message "`epa-dired' enabled")))
+ 
+ ;;;###autoload
+ (defun epa-dired-disable ()
+   (interactive)
+   (if (and (boundp 'dired-mode-hook)
+          (memq 'epa-dired-mode-hook dired-mode-hook))
+       (progn
+       (remove-hook 'dired-mode-hook 'epa-dired-mode-hook)
+       (message "`epa-dired' disabled"))
+     (message "`epa-dired' already disabled")))
+ 
  (provide 'epa-dired)
  
  ;; arch-tag: 2025700b-48d0-4684-bc94-228ad1f8e9ff
Index: lisp/epa-mail.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/epa-mail.el,v
retrieving revision 1.2
diff -c -r1.2 epa-mail.el
*** lisp/epa-mail.el    9 Feb 2008 02:29:01 -0000       1.2
--- lisp/epa-mail.el    10 Feb 2008 07:02:33 -0000
***************
*** 40,45 ****
--- 40,46 ----
  (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,178 ****
--- 174,198 ----
    (interactive)
    (epa-import-armor-in-region (point-min) (point-max)))
  
+ ;;;###autoload
+ (defun epa-mail-enable ()
+   (interactive)
+   (if (and (boundp 'mail-mode-hook)
+          (memq 'epa-mail-mode mail-mode-hook))
+       (message "`epa-mail' already enabled")
+     (add-hook 'mail-mode-hook 'epa-mail-mode)
+     (message "`epa-mail' enabled")))
+ 
+ ;;;###autoload
+ (defun epa-mail-disable ()
+   (interactive)
+   (if (and (boundp 'mail-mode-hook)
+          (memq 'epa-mail-mode mail-mode-hook))
+       (progn
+       (remove-hook 'mail-mode-hook 'epa-mail-mode)
+       (message "`epa-mail' disabled"))
+     (message "`epa-mail' already disabled")))
+ 
  (provide 'epa-mail)
  
  ;; arch-tag: a6f82b3f-d177-4a11-af95-040da55927d2
Index: lisp/epa.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/epa.el,v
retrieving revision 1.3
diff -c -r1.3 epa.el
*** lisp/epa.el 9 Feb 2008 21:59:33 -0000       1.3
--- lisp/epa.el 10 Feb 2008 07:02:33 -0000
***************
*** 45,50 ****
--- 45,55 ----
    :type 'integer
    :group 'epa)
  
+ (defcustom epa-features '(epa-dired epa-file epa-mail epa-menu)
+   "Add-on features to other modes."
+   :type '(repeat symbol)
+   :group 'epa)
+ 
  (defgroup epa-faces nil
    "Faces for epa-mode."
    :version "23.1"
***************
*** 229,234 ****
--- 234,277 ----
      (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,378 ****
                                     'end-open t))
          (widget-create 'epa-key :value (car keys))
          (insert "\n")
!         (setq keys (cdr keys))))      
        (add-text-properties (point-min) (point-max)
                           (list 'epa-list-keys t
                                 'front-sticky nil
--- 415,421 ----
                                     'end-open t))
          (widget-create 'epa-key :value (car keys))
          (insert "\n")
!         (setq keys (cdr keys))))
        (add-text-properties (point-min) (point-max)
                           (list 'epa-list-keys t
                                 'front-sticky nil
***************
*** 1173,1178 ****
--- 1216,1273 ----
  ;;     (message "Signing keys...done")))
  ;; (make-obsolete 'epa-sign-keys "Do not use.")
  
+ ;;;###autoload
+ (defun epa-menu-enable ()
+   "Add the EasyPG Assistant menu on the menu-bar."
+   (interactive)
+   (if epa-menu
+       (message "`epa-menu' alread enabled")
+     (easy-menu-define epa-menu nil "EasyPG Assistant global menu"
+       epa-menu-items)
+     (easy-menu-add-item nil '("Tools") epa-menu)
+     (message "`epa-menu' enabled")))
+ 
+ ;;;###autoload
+ (defun epa-menu-disable ()
+   "Remove the EasyPG Assistant menu from the menu-bar."
+   (interactive)
+   (if epa-menu
+       (progn
+       (easy-menu-remove-item nil '("Tools") "EasyPG Assistant")
+       (setq epa-menu nil)
+       (message "`epa-menu' disabled"))
+     (message "`epa-menu' already disabled")))
+ 
+ ;;;###autoload
+ (defun epa-enable ()
+   "Enable EasyPG Assistant features.
+ See `epa-features'."
+   (interactive)
+   (let ((pointer epa-features)
+       symbol)
+     (while pointer
+       (setq symbol (intern-soft (format "%S-enable" (car pointer))))
+       (if (and symbol
+              (fboundp symbol))
+         (funcall symbol)
+       (message "`%S' not found" (car pointer)))
+       (setq pointer (cdr pointer)))))
+ 
+ ;;;###autoload
+ (defun epa-disable ()
+   "Disable EasyPG Assistant features.
+ See `epa-features'."
+   (interactive)
+   (let ((pointer epa-features)
+       symbol)
+     (while pointer
+       (setq symbol (intern-soft (format "%S-disable" (car pointer))))
+       (if (and symbol
+              (fboundp symbol))
+         (funcall symbol)
+       (message "`%S' not found" (car pointer)))
+       (setq pointer (cdr pointer)))))
+ 
  (provide 'epa)
  
  ;; arch-tag: 38d20ced-20d5-4137-b17a-f206335423d7
Index: lisp/epg-config.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/epg-config.el,v
retrieving revision 1.3
diff -c -r1.3 epg-config.el
*** lisp/epg-config.el  9 Feb 2008 21:59:33 -0000       1.3
--- lisp/epg-config.el  10 Feb 2008 07:02:33 -0000
***************
*** 23,29 ****
  
  ;;; Code:
  
! (require 'epg-package-info)
  
  (defgroup epg ()
    "The EasyPG Library"
--- 23,36 ----
  
  ;;; Code:
  
! (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 "address@hidden"
!   "Report bugs to this address.")
  
  (defgroup epg ()
    "The EasyPG Library"
Index: lisp/epg.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/epg.el,v
retrieving revision 1.2
diff -c -r1.2 epg.el
*** lisp/epg.el 9 Feb 2008 02:29:02 -0000       1.2
--- lisp/epg.el 10 Feb 2008 07:02:36 -0000
***************
*** 1430,1436 ****
         signature
         (string-to-number (match-string 4 string)))
        (epg-signature-set-pubkey-algorithm
!        signature 
         (string-to-number (match-string 5 string)))
        (epg-signature-set-digest-algorithm
         signature
--- 1430,1436 ----
         signature
         (string-to-number (match-string 4 string)))
        (epg-signature-set-pubkey-algorithm
!        signature
         (string-to-number (match-string 5 string)))
        (epg-signature-set-digest-algorithm
         signature
***************
*** 1744,1750 ****
  (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. 
  Otherwise, only public keyring should be searched and the key
  signatures should be included.
  NAME is either a string or a list of strings."
--- 1744,1750 ----
  (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.
  Otherwise, only public keyring should be searched and the key
  signatures should be included.
  NAME is either a string or a list of strings."

Regards,
-- 
Daiki Ueno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]