--- 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