emacs-devel
[Top][All Lists]
Advanced

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

Re: pgg-encrypt is a pain in the neck


From: Reiner Steib
Subject: Re: pgg-encrypt is a pain in the neck
Date: Sun, 31 Dec 2006 15:07:50 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.92 (gnu/linux)

On Sun, Dec 31 2006, Sascha Wilde wrote:

> Daiki Ueno <address@hidden> wrote:
>
>> I think it's not a bad idea to make pgg-encrypt (not pgg-encrypt-region)
>> use such a heuristics, and actually it's not hard to implement.
>
> I agree, but don't know if it's TRTTD before the release.

How about adding two simple wrapper functions to `sendmail.el'?
`mail-encrypt-body' and `mail-decrypt-body'?

Something *similar* to the commands below.  I don't use Rmail and I'm
not sure if the use of PGG especially in `mail-decrypt-body' is the
right thing.  And probably there should be a command to replace the
encryped text with the decrypted text.

--8<---------------cut here---------------start------------->8---
(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))))

(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)))))
--8<---------------cut here---------------end--------------->8---

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




reply via email to

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