From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/55267 Path: main.gmane.org!not-for-mail From: Jesper Harder Newsgroups: gmane.emacs.gnus.general Subject: Re: Buttonizing and decoding based on message part contents? Date: Wed, 17 Dec 2003 23:13:56 +0100 Sender: ding-owner@lists.math.uh.edu Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1071699439 10204 80.91.224.253 (17 Dec 2003 22:17:19 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 17 Dec 2003 22:17:19 +0000 (UTC) Original-X-From: ding-owner+M3807@lists.math.uh.edu Wed Dec 17 23:17:16 2003 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AWjym-0008RL-00 for ; Wed, 17 Dec 2003 23:17:16 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1AWjyJ-0004Bk-00; Wed, 17 Dec 2003 16:16:47 -0600 Original-Received: from justine.libertine.org ([66.139.78.221] ident=postfix) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1AWjyA-0004Be-00 for ding@lists.math.uh.edu; Wed, 17 Dec 2003 16:16:38 -0600 Original-Received: from pfepa.post.tele.dk (pfepa.post.tele.dk [195.41.46.235]) by justine.libertine.org (Postfix) with ESMTP id 4B5503A0039 for ; Wed, 17 Dec 2003 16:16:37 -0600 (CST) Original-Received: from [195.249.130.65] (0xc3f98241.esnxr3.ras.tele.dk [195.249.130.65]) by pfepa.post.tele.dk (Postfix) with ESMTP id 025F948004D for ; Wed, 17 Dec 2003 23:16:32 +0100 (CET) Original-To: ding@gnus.org Mail-Followup-To: ding@gnus.org In-Reply-To: (Lloyd Zusman's message of "Wed, 17 Dec 2003 10:43:03 -0500") User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) Precedence: bulk Xref: main.gmane.org gmane.emacs.gnus.general:55267 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:55267 --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Lloyd Zusman writes: > Jesper Harder writes: > >> Lloyd Zusman writes: >> >>> But this particular piece of obsolete functionality has no >>> replacement, correct? >> >> Well, I don't actually know if `article-hide-pgp' did anything >> useful for multiparts. It does, at least for text/plain parts. Try the attached patch. > If there was a hook function that gets called for each message part > (and which allows me to set the display and buttonizing status for > each part), I could then write my own, personal code to handle this > case, and at the same time avoid polluting the Gnus code base with > this anachronism. The bad thing isn't pollution, but that the approach `article-hide-pgp' uses doesn't really solve the problems. It just hides them, viz. =B7 It doesn't allow you to actually verify the signatures. =B7 It doesn't work for encrypted parts. =B7 It doesn't necessarily (I haven't tested) solve the related problem of format=3Dflowed & old-style PGP. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=gnus-art.el.diff --- gnus/lisp/gnus-art.el Tue Nov 25 12:54:07 2003 +++ cvsgnus/lisp/gnus-art.el Wed Dec 17 23:11:33 2003 @@ -562,8 +562,12 @@ :type 'hook :group 'gnus-article-various) -(make-obsolete-variable 'gnus-article-hide-pgp-hook - "This variable is obsolete in Gnus 5.10.") +;(make-obsolete-variable 'gnus-article-hide-pgp-hook +; "This variable is obsolete in Gnus 5.10.") +(defcustom gnus-article-hide-pgp-hook nil + "*A hook called after successfully hiding a PGP signature." + :type 'hook + :group 'gnus-article-various) (defcustom gnus-article-button-face 'bold "Face used for highlighting buttons in the article buffer. @@ -985,8 +989,16 @@ :link '(custom-manual "(gnus)Customizing Articles") :type gnus-article-treat-custom) -(make-obsolete-variable 'gnus-treat-strip-pgp - "This option is obsolete in Gnus 5.10.") +;(make-obsolete-variable 'gnus-treat-strip-pgp +; "This option is obsolete in Gnus 5.10.") + +(defcustom gnus-treat-strip-pgp t + "Strip PGP signatures. +Valid values are nil, t, `head', `last', an integer or a predicate. +See Info node `(gnus)Customizing Articles' for details." + :group 'gnus-article-treat + :link '(custom-manual "(gnus)Customizing Articles") + :type gnus-article-treat-custom) (defcustom gnus-treat-strip-pem nil "Strip PEM signatures. @@ -1396,6 +1408,7 @@ (gnus-treat-hide-signature gnus-article-hide-signature) (gnus-treat-strip-list-identifiers gnus-article-hide-list-identifiers) (gnus-treat-leading-whitespace gnus-article-remove-leading-whitespace) + (gnus-treat-strip-pgp gnus-article-hide-pgp) (gnus-treat-strip-pem gnus-article-hide-pem) (gnus-treat-from-picon gnus-treat-from-picon) (gnus-treat-mail-picon gnus-treat-mail-picon) @@ -2416,6 +2429,42 @@ "^Subject: +\\(\\(R[Ee]: +\\)+\\)R[Ee]: +" nil t) (delete-region (match-beginning 1) (match-end 1)))))))) +(defun article-hide-pgp () + "Remove any PGP headers and signatures in the current article." + (interactive) + (save-excursion + (save-restriction + (let ((inhibit-point-motion-hooks t) + buffer-read-only beg end) + (article-goto-body) + ;; Hide the "header". + (when (re-search-forward "^-----BEGIN PGP SIGNED MESSAGE-----\n" nil t) + (gnus-add-wash-type 'pgp) + (delete-region (match-beginning 0) (match-end 0)) + ;; Remove armor headers (rfc2440 6.2) + (delete-region (point) (or (re-search-forward "^[ \t]*\n" nil t) + (point))) + (setq beg (point)) + ;; Hide the actual signature. + (and (search-forward "\n-----BEGIN PGP SIGNATURE-----\n" nil t) + (setq end (1+ (match-beginning 0))) + (delete-region + end + (if (search-forward "\n-----END PGP SIGNATURE-----\n" nil t) + (match-end 0) + ;; Perhaps we shouldn't hide to the end of the buffer + ;; if there is no end to the signature? + (point-max)))) + ;; Hide "- " PGP quotation markers. + (when (and beg end) + (narrow-to-region beg end) + (goto-char (point-min)) + (while (re-search-forward "^- " nil t) + (delete-region + (match-beginning 0) (match-end 0))) + (widen)) + (gnus-run-hooks 'gnus-article-hide-pgp-hook)))))) + (defun article-hide-pem (&optional arg) "Toggle hiding of any PEM headers and signatures in the current article. If given a negative prefix, always show; if given a positive prefix, @@ -3482,6 +3531,7 @@ article-wash-html article-unsplit-urls article-hide-list-identifiers + article-hide-pgp article-strip-banner article-babel article-hide-pem --=-=-=--