all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Daiki Ueno <ueno@unixuser.org>
Cc: emacs-devel@gnu.org, rms@gnu.org, reinersteib+gmane@imap.cc
Subject: Re: pgg-encrypt is a pain in the neck
Date: Sun, 31 Dec 2006 23:13:24 +0900	[thread overview]
Message-ID: <59af811b-d38b-4c25-9cbd-9b3f836549ee@well-done.deisui.org> (raw)
In-Reply-To: <m27iw8xm2u.fsf@kenny.sha-bang.de> (Sascha Wilde's message of "Sun, 31 Dec 2006 13:54:17 +0100")

>>>>> In <m27iw8xm2u.fsf@kenny.sha-bang.de> 
>>>>>	Sascha Wilde <wilde@sha-bang.de> wrote:
> > There seems to be a disagreement about this.  Daiki Ueno told me that
> > PGG could do what Mailcrypt does; I found it cannot, and you say it
> > isn't supposed to.

> I can't speak for Daiki, but as I see it PGG on its own can't but
> together with message mode it can, so this might be what he meant.

It was my mistake that I answered to Richard's question with simply
"Yes".

What I meant was not "PGG's interactive commands behave exactly same as
Mailcrypt's interactive commands" but "things he wanted could be done
with PGG's interactive commands (with some basic commands)".  For
example, to encrypt a mail, people can do `C-x n n' to narrow to the
mail body and `M-x pgg-encrypt'.

However, I agree with that PGG's interactive commands sucks in usability.

> > Meanwhile, it is unfortunate that Emacs has most of what is needed to
> > do the job of Mailcrypt but fails to actually deliver that
> > functionality to the user.  I hope people will implement this, soon
> > after the release.

> I agree, and as Daiki wrote it shouldn't be to hard to do.

Here is the patch.  Though it might look not so trivial, it only changes
the interactive behavior of pgg-encrypt and pgg-decrypt so it should
bring no harm to other Lisp programs.

Index: lisp/pgg.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/pgg.el,v
retrieving revision 1.4
diff -c -r1.4 pgg.el
*** lisp/pgg.el	5 Sep 2006 08:17:35 -0000	1.4
--- lisp/pgg.el	31 Dec 2006 14:12:54 -0000
***************
*** 37,42 ****
--- 37,44 ----
  (eval-when-compile
    (require 'cl))
  
+ (require 'mail-utils)
+ 
  ;;; @ utility functions
  ;;;
  
***************
*** 367,373 ****
  
  If optional PASSPHRASE is not specified, it will be obtained from the
  passphrase cache or user."
!   (interactive (list (split-string (read-string "Recipients: ") "[ \t,]+")))
    (let* ((start (or start (point-min)))
  	 (end (or end (point-max)))
  	 (status (pgg-encrypt-region start end rcpts sign passphrase)))
--- 369,399 ----
  
  If optional PASSPHRASE is not specified, it will be obtained from the
  passphrase cache or user."
!   (interactive
!    (save-excursion
!      (let (recipients)
!        (goto-char (point-min))
!        (when (eq major-mode 'mail-mode)
! 	 (save-restriction
! 	   (narrow-to-region (point)
! 			     (progn
! 			       (search-forward mail-header-separator nil 0)
! 			       (match-beginning 0)))
! 	   (setq recipients
! 		 (mail-strip-quoted-names
! 		  (mapconcat #'identity
! 			     (nconc (mail-fetch-field "to" nil nil t)
! 				    (mail-fetch-field "cc" nil nil t)
! 				    (mail-fetch-field "bcc" nil nil t))
! 			     ","))))
! 	 (if recipients
! 	     (setq recipients (delete "" (split-string recipients "[ \t\n]+"))))
! 	 (goto-char (point-min))
! 	 (if (search-forward mail-header-separator nil t)
! 	     (forward-line)))
!        (list (or recipients
! 		 (split-string (read-string "Recipients: ") "[ \t,]+"))
! 	     nil (point) (point-max)))))
    (let* ((start (or start (point-min)))
  	 (end (or end (point-max)))
  	 (status (pgg-encrypt-region start end rcpts sign passphrase)))
***************
*** 400,412 ****
  
  If optional PASSPHRASE is not specified, it will be obtained from the
  passphrase cache or user."
!   (interactive "")
!   (let* ((start (or start (point-min)))
! 	 (end (or end (point-max)))
! 	 (status (pgg-decrypt-region start end passphrase)))
!     (when (interactive-p)
!       (pgg-display-output-buffer start end status))
!     status))
  
  ;;;###autoload
  (defun pgg-sign-region (start end &optional cleartext passphrase)
--- 426,455 ----
  
  If optional PASSPHRASE is not specified, it will be obtained from the
  passphrase cache or user."
!   (interactive)
!   (if (interactive-p)
!       (let (cipher status)
! 	(goto-char (point-min))
! 	(if (re-search-forward "-----BEGIN PGP MESSAGE-----$" nil t)
! 	    (setq start (match-beginning 0)
! 		  end (re-search-forward "^-----END PGP MESSAGE-----$" nil t)))
! 	(unless end
! 	  (error "No armor tail"))
! 	(setq cipher (buffer-substring start end))
! 	(with-temp-buffer
! 	  (insert cipher)
! 	  (setq status (pgg-decrypt-region (point-min) (point-max))))
! 	(if status
! 	    (if (y-or-n-p "Replace text? ")
! 		(let ((inhibit-read-only t)
! 		      buffer-read-only)
! 		  (pgg-situate-output start end))
! 	      (with-output-to-temp-buffer pgg-echo-buffer
! 		(set-buffer standard-output)
! 		(insert-buffer pgg-output-buffer)))
! 	  (pgg-display-error-buffer)))
!     (pgg-decrypt-region (or start (point-min)) (or end (point-max))
! 			passphrase)))
  
  ;;;###autoload
  (defun pgg-sign-region (start end &optional cleartext passphrase)

-- 
Daiki Ueno

  reply	other threads:[~2006-12-31 14:13 UTC|newest]

Thread overview: 122+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-13 18:41 Syncing Gnus and Emacs repositories Reiner Steib
2007-06-13 19:57 ` Stefan Monnier
2007-06-13 21:47   ` Reiner Steib
2007-06-13 22:21     ` Stefan Monnier
2007-06-13 22:41       ` Glenn Morris
2007-06-13 23:22         ` Chong Yidong
2007-06-14  6:31           ` Emacs 23 development policy (was: Syncing Gnus and Emacs repositories) Reiner Steib
2007-06-14  7:25             ` David Reitter
2007-06-14 13:42               ` Adrian Robert
2007-06-14 19:56                 ` Emacs 23 development policy Stefan Monnier
2007-06-14 16:20           ` Syncing Gnus and Emacs repositories Richard Stallman
2007-06-14 16:27             ` Chong Yidong
2007-06-15  0:57               ` Kenichi Handa
2007-06-15  2:03                 ` Miles Bader
2007-06-15  3:14                   ` Kenichi Handa
2007-06-15  2:35                 ` Nick Roberts
2007-06-15 19:22                   ` Richard Stallman
2007-06-15 21:48                     ` Nick Roberts
2007-06-16 18:50                       ` Richard Stallman
2007-06-16 19:23                         ` Chong Yidong
2007-06-16 19:28                           ` David Kastrup
2007-06-17  8:54                             ` Richard Stallman
2007-06-17 19:47                               ` David Kastrup
2007-06-17  8:54                           ` Richard Stallman
2007-06-18  1:36                             ` Kenichi Handa
2007-06-18 21:30                               ` Richard Stallman
2007-06-19  5:01                                 ` Kenichi Handa
2007-06-19  5:31                                   ` Stefan Monnier
2007-06-19 22:26                                   ` Richard Stallman
2007-06-20 13:18                                     ` Kenichi Handa
2007-06-20 17:36                                       ` Richard Stallman
2007-06-15 22:12                     ` David Kastrup
2007-06-16 10:48                       ` Eli Zaretskii
2007-06-16 12:09                         ` David Kastrup
2007-06-16 13:01                           ` Eli Zaretskii
2007-06-16 13:13                             ` David Kastrup
2007-06-16 13:23                               ` Eli Zaretskii
2007-06-16 14:05                                 ` David Kastrup
2007-06-16 16:34                                   ` Eli Zaretskii
2007-06-16 17:38                                     ` David Kastrup
2007-06-16 18:26                                       ` Eli Zaretskii
2007-06-16 13:55                               ` YAMAMOTO Mitsuharu
2007-06-16 14:16                                 ` David Kastrup
2007-06-17 23:07                             ` Kenichi Handa
2007-06-18  3:10                               ` Eli Zaretskii
2007-06-18  5:18                                 ` David Kastrup
2007-06-18  6:01                                   ` Nick Roberts
2007-06-18 19:12                                     ` Eli Zaretskii
2007-06-18 21:12                                       ` Nick Roberts
2007-06-19 22:25                                       ` Richard Stallman
2007-06-18 19:11                                   ` Eli Zaretskii
2007-06-18 21:30                                   ` Richard Stallman
2007-06-18  6:53                                 ` Stephen J. Turnbull
2007-06-18  7:24                                   ` David Kastrup
2007-06-18  8:34                                     ` Stephen J. Turnbull
2007-06-18  8:50                                       ` David Kastrup
2007-06-18 19:23                                   ` Eli Zaretskii
2007-06-19  0:53                                     ` Stephen J. Turnbull
2007-06-19  5:17                                       ` Eli Zaretskii
2007-06-19  5:37                                         ` David Kastrup
2007-06-19  6:09                                           ` Eli Zaretskii
2007-06-19 17:53                                             ` Stephen J. Turnbull
2007-06-19  5:21                                       ` David Kastrup
2007-06-19  2:19                                     ` Kenichi Handa
2007-06-19  5:20                                       ` Eli Zaretskii
2007-06-23  8:13                                   ` Giorgos Keramidas
2007-06-16 18:50                       ` Richard Stallman
2007-06-16 14:22                     ` Proposal for a 22.2/trunk development model (was: Syncing Gnus and Emacs repositories) Dan Nicolaescu
2007-06-16 14:37                       ` Proposal for a 22.2/trunk development model David Kastrup
2007-06-16 16:01                         ` Dan Nicolaescu
2007-06-16 16:41                           ` David Kastrup
2007-06-16 17:05                             ` Dan Nicolaescu
2007-07-01 20:40                       ` Proposal for a 22.2/trunk development model (was: Syncing Gnus and Emacs repositories) Richard Stallman
2007-06-15 19:21               ` Syncing Gnus and Emacs repositories Richard Stallman
2007-06-14 16:48             ` Jay Belanger
2007-06-17 13:47     ` Reiner Steib
2007-07-09  2:22       ` Miles Bader
2007-07-09 17:21         ` Richard Stallman
2007-07-10 10:33           ` Miles Bader
2007-07-10 12:19             ` Daiki Ueno
2007-07-10 15:51               ` Leo
2007-07-10 20:05                 ` Miles Bader
2006-12-16  2:58                   ` [bug] PGG shows ?? when prompt for passphrase Leo
2006-12-17  1:30                     ` Daiki Ueno
2006-12-17  2:18                       ` Leo
2006-12-17  3:28                         ` Daiki Ueno
2006-12-17  4:18                           ` Leo
2006-12-17  4:28                             ` Daiki Ueno
2006-12-17  5:27                               ` Leo
2006-12-18  1:12                               ` Richard Stallman
2006-12-18  1:34                                 ` Daiki Ueno
     [not found]                                   ` <E1GwhJI-0003jz-GI@fencepost.gnu.org>
2006-12-19 23:55                                     ` Daiki Ueno
     [not found]                           ` <E1Gw733-00050z-Ic@fencepost.gnu.org>
     [not found]                             ` <c371ac3b-6629-4e1a-a023-92982698664b@well-done.deisui.org>
     [not found]                               ` <6662a3b9-1148-4aa0-bd2d-29a67be38d76@well-done.deisui.org>
     [not found]                                 ` <E1Gx14z-0000Zc-Lm@fencepost.gnu.org>
     [not found]                                   ` <5a520e06-4ee3-4c4f-9345-d49a666516f9@well-done.deisui.org>
     [not found]                                     ` <E1GyDFo-00006s-IW@fencepost.gnu.org>
     [not found]                                       ` <7f60c21d-2f66-4c4b-9abb-e377ca24a153@well-done.deisui.org>
     [not found]                                         ` <fe674575-f87f-46e4-8287-6481b3fc6f03@well-done.deisui.org>
     [not found]                                           ` <E1Gz20z-0003hC-Nb@fencepost.gnu.org>
     [not found]                                             ` <844cd50a-ec18-4b09-a057-35bdfb5173fd@well-done.deisui.org>
     [not found]                                               ` <E1GzP1P-0006JH-Lb@fencepost.gnu.org>
     [not found]                                                 ` <8ba25607-9381-4a27-ae53-8b0f3ccc3ac1@well-done.deisui.org>
     [not found]                                                   ` <E1Gzg8G-0002bZ-JG@fencepost.gnu.org>
     [not found]                                                     ` <366fa6ab-42a0-4df5-a17f-4ac3d1744d78@well-done.deisui.org>
     [not found]                                                       ` <E1H0Jui-0005YH-HB@fencepost.gnu.org>
     [not found]                                                         ` <ec5e0f1b-45c5-4ed5-ae1c-766fa33e3ee0@well-done.deisui.org>
2006-12-30 18:24                                                           ` pgg-encrypt is a pain in the neck Richard Stallman
2006-12-30 19:41                                                             ` Sascha Wilde
2006-12-31  1:02                                                               ` Daiki Ueno
2006-12-31 12:27                                                                 ` Sascha Wilde
2006-12-31 14:07                                                                   ` Reiner Steib
2006-12-31 14:38                                                                     ` Daiki Ueno
2006-12-31 22:13                                                                     ` Richard Stallman
2006-12-31  1:47                                                               ` Richard Stallman
2006-12-31 12:54                                                                 ` Sascha Wilde
2006-12-31 14:13                                                                   ` Daiki Ueno [this message]
2006-12-31 22:13                                                                   ` Richard Stallman
2007-01-02  0:28                                                                     ` Daiki Ueno
2007-01-02 16:37                                                                       ` Richard Stallman
2007-01-02 19:53                                                                         ` Reiner Steib
2006-12-31 22:13                                                                   ` Richard Stallman
2007-01-02 18:43                                                                     ` Stefan Monnier
2006-12-31  1:46                                                           ` Richard Stallman
     [not found]                                                       ` <E1H0Juj-0005YY-RU@fencepost.gnu.org>
2007-07-10 22:47                                                         ` Syncing Gnus and Emacs repositories Daiki Ueno
2007-07-10 22:54                                                           ` Miles Bader
2007-07-11  0:07                                                             ` Daiki Ueno
2007-07-11 21:03                                                           ` Richard Stallman
2007-07-10 21:29                   ` Stefan Monnier
2007-07-11  2:25                     ` Miles Bader
2007-07-11 21:03                       ` Richard Stallman
2007-07-11  3:05                 ` Richard Stallman
2007-07-11  3:43                   ` Daiki Ueno
2007-07-11  9:38                     ` Sascha Wilde
2007-07-11 10:22                       ` Daiki Ueno
2007-07-11 21:04                     ` Richard Stallman
2007-06-14  8:38 ` Miles Bader

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=59af811b-d38b-4c25-9cbd-9b3f836549ee@well-done.deisui.org \
    --to=ueno@unixuser.org \
    --cc=emacs-devel@gnu.org \
    --cc=reinersteib+gmane@imap.cc \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.