From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: pgg-encrypt is a pain in the neck Date: Sun, 31 Dec 2006 17:13:20 -0500 Message-ID: References: <6662a3b9-1148-4aa0-bd2d-29a67be38d76@well-done.deisui.org> <5a520e06-4ee3-4c4f-9345-d49a666516f9@well-done.deisui.org> <7f60c21d-2f66-4c4b-9abb-e377ca24a153@well-done.deisui.org> <844cd50a-ec18-4b09-a057-35bdfb5173fd@well-done.deisui.org> <8ba25607-9381-4a27-ae53-8b0f3ccc3ac1@well-done.deisui.org> <366fa6ab-42a0-4df5-a17f-4ac3d1744d78@well-done.deisui.org> Reply-To: rms@gnu.org NNTP-Posting-Host: lo.gmane.org Content-Type: text/plain; charset=ISO-8859-15 X-Trace: sea.gmane.org 1167603327 32487 80.91.229.12 (31 Dec 2006 22:15:27 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 31 Dec 2006 22:15:27 +0000 (UTC) Cc: wilde@sha-bang.de, ueno@unixuser.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Dec 31 23:15:26 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1H18xf-0002oh-PS for ged-emacs-devel@m.gmane.org; Sun, 31 Dec 2006 23:15:24 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H18xf-0005Fs-7M for ged-emacs-devel@m.gmane.org; Sun, 31 Dec 2006 17:15:23 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H18vz-0003uA-MF for emacs-devel@gnu.org; Sun, 31 Dec 2006 17:13:39 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H18vy-0003t2-P3 for emacs-devel@gnu.org; Sun, 31 Dec 2006 17:13:39 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H18vy-0003sh-DS for emacs-devel@gnu.org; Sun, 31 Dec 2006 17:13:38 -0500 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.52) id 1H18vy-0002n2-3E for emacs-devel@gnu.org; Sun, 31 Dec 2006 17:13:38 -0500 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.60) (envelope-from ) id 1H18vg-0007ME-Jm; Sun, 31 Dec 2006 17:13:20 -0500 Original-To: Reiner Steib In-reply-to: (message from Reiner Steib on Sun, 31 Dec 2006 15:07:50 +0100) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:64577 Archived-At: (defun mail-narrow-to-body () "Narrow to mail body, excluding mail headers." (goto-char (point-min)) (narrow-to-region (progn (mail-text) (point)) ;; Or (cf. `message-goto-body') ... ;; (or (search-forward (concat "\n" mail-header-separator "\n") nil t) ;; (search-forward-regexp "[^:]+:\\([^\n]\\|\n[ \t]\\)+\n\n" nil t)) (point-max))) (defun mail-encrypt-body () (interactive) (save-excursion (save-restriction (mail-narrow-to-body) (call-interactively 'pgg-encrypt)))) This looks like a good start. However, instead of using call-interactively to call pgg-encrypt, it should read the argument itself, and supply a default based on the addresses in the message. You can find the code to get those addresses in sendmail-send-it. I think something similar is needed for pgg-sign, so as to will sign just the message body and not the headers. (defun mail-decrypt-body (&optional passphrase) (interactive) (save-excursion (save-restriction (mail-narrow-to-body) (if (apply 'pgg-decrypt-region (point-min) (point-max) passphrase) (pop-to-buffer pgg-output-buffer) (pgg-display-error-buffer))))) This would work fine in Mail mode, but it also needs to handle Rmail mode. Decrypting is done once in a while in Mail mode, but Rmail mode is where it is usually done. Daiki's code for decryption does more of the right thing. That could be put into a command called mail-decrypt, to avoid changing pgg itself.