comparison lisp/gnus/gnus-art.el @ 163:0132846995bd r20-3b8

Import from CVS: tag r20-3b8
author cvs
date Mon, 13 Aug 2007 09:43:35 +0200
parents 43dd3413c7c7
children 85ec50267440
comparison
equal deleted inserted replaced
162:4de2936b4e77 163:0132846995bd
581 "Delete text of TYPE in the current buffer." 581 "Delete text of TYPE in the current buffer."
582 (save-excursion 582 (save-excursion
583 (let ((b (point-min))) 583 (let ((b (point-min)))
584 (while (setq b (text-property-any b (point-max) 'article-type type)) 584 (while (setq b (text-property-any b (point-max) 'article-type type))
585 (delete-region 585 (delete-region
586 b (text-property-not-all b (point-max) 'article-type type)))))) 586 b (or (text-property-not-all b (point-max) 'article-type type)
587 (point-max)))))))
587 588
588 (defun gnus-article-delete-invisible-text () 589 (defun gnus-article-delete-invisible-text ()
589 "Delete all invisible text in the current buffer." 590 "Delete all invisible text in the current buffer."
590 (save-excursion 591 (save-excursion
591 (let ((b (point-min))) 592 (let ((b (point-min)))
592 (while (setq b (text-property-any b (point-max) 'invisible t)) 593 (while (setq b (text-property-any b (point-max) 'invisible t))
593 (delete-region 594 (delete-region
594 b (text-property-not-all b (point-max) 'invisible t)))))) 595 b (or (text-property-not-all b (point-max) 'invisible t)
596 (point-max)))))))
595 597
596 (defun gnus-article-text-type-exists-p (type) 598 (defun gnus-article-text-type-exists-p (type)
597 "Say whether any text of type TYPE exists in the buffer." 599 "Say whether any text of type TYPE exists in the buffer."
598 (text-property-any (point-min) (point-max) 'article-type type)) 600 (text-property-any (point-min) (point-max) 'article-type type))
599 601
957 (widen) 959 (widen)
958 (goto-char (point-min)) 960 (goto-char (point-min))
959 ;; Hide the "header". 961 ;; Hide the "header".
960 (when (search-forward "\n-----BEGIN PGP SIGNED MESSAGE-----\n" nil t) 962 (when (search-forward "\n-----BEGIN PGP SIGNED MESSAGE-----\n" nil t)
961 (gnus-article-hide-text-type (1+ (match-beginning 0)) 963 (gnus-article-hide-text-type (1+ (match-beginning 0))
962 (match-end 0) 'pgp)) 964 (match-end 0) 'pgp)
963 (setq beg (point)) 965 (setq beg (point))
964 ;; Hide the actual signature. 966 ;; Hide the actual signature.
965 (and (search-forward "\n-----BEGIN PGP SIGNATURE-----\n" nil t) 967 (and (search-forward "\n-----BEGIN PGP SIGNATURE-----\n" nil t)
966 (setq end (1+ (match-beginning 0))) 968 (setq end (1+ (match-beginning 0)))
967 (gnus-article-hide-text-type 969 (gnus-article-hide-text-type
968 end 970 end
969 (if (search-forward "\n-----END PGP SIGNATURE-----\n" nil t) 971 (if (search-forward "\n-----END PGP SIGNATURE-----\n" nil t)
970 (match-end 0) 972 (match-end 0)
971 ;; Perhaps we shouldn't hide to the end of the buffer 973 ;; Perhaps we shouldn't hide to the end of the buffer
972 ;; if there is no end to the signature? 974 ;; if there is no end to the signature?
973 (point-max)) 975 (point-max))
974 'pgp)) 976 'pgp))
975 ;; Hide "- " PGP quotation markers. 977 ;; Hide "- " PGP quotation markers.
976 (when (and beg end) 978 (when (and beg end)
977 (narrow-to-region beg end) 979 (narrow-to-region beg end)
978 (goto-char (point-min)) 980 (goto-char (point-min))
979 (while (re-search-forward "^- " nil t) 981 (while (re-search-forward "^- " nil t)
980 (gnus-article-hide-text-type 982 (gnus-article-hide-text-type
981 (match-beginning 0) (match-end 0) 'pgp)) 983 (match-beginning 0) (match-end 0) 'pgp))
982 (widen))) 984 (widen)))
983 (run-hooks 'gnus-article-hide-pgp-hook)))) 985 (run-hooks 'gnus-article-hide-pgp-hook)))))
984 986
985 (defun article-hide-pem (&optional arg) 987 (defun article-hide-pem (&optional arg)
986 "Toggle hiding of any PEM headers and signatures in the current article. 988 "Toggle hiding of any PEM headers and signatures in the current article.
987 If given a negative prefix, always show; if given a positive prefix, 989 If given a negative prefix, always show; if given a positive prefix,
988 always hide." 990 always hide."
1122 t 1124 t
1123 (goto-char cur) 1125 (goto-char cur)
1124 nil))) 1126 nil)))
1125 1127
1126 (eval-and-compile 1128 (eval-and-compile
1127 (autoload 'w3-parse-buffer "w3-parse")) 1129 (autoload 'w3-parse-buffer "w3-parse")
1130 (autoload 'w3-do-setup "w3" "" t))
1128 1131
1129 (defun gnus-article-treat-html () 1132 (defun gnus-article-treat-html ()
1130 "Render HTML." 1133 "Render HTML."
1131 (interactive) 1134 (interactive)
1132 (let ((cbuf (current-buffer))) 1135 (let ((cbuf (current-buffer)))
1133 (set-buffer gnus-article-buffer) 1136 (set-buffer gnus-article-buffer)
1134 (let (buf buffer-read-only b e) 1137 (let (buf buffer-read-only b e)
1138 (w3-do-setup)
1135 (goto-char (point-min)) 1139 (goto-char (point-min))
1136 (narrow-to-region 1140 (narrow-to-region
1137 (if (search-forward "\n\n" nil t) 1141 (if (search-forward "\n\n" nil t)
1138 (setq b (point)) 1142 (setq b (point))
1139 (point-max)) 1143 (point-max))
1744 (put 'gnus-article-mode 'mode-class 'special) 1748 (put 'gnus-article-mode 'mode-class 'special)
1745 1749
1746 (gnus-define-keys gnus-article-mode-map 1750 (gnus-define-keys gnus-article-mode-map
1747 " " gnus-article-goto-next-page 1751 " " gnus-article-goto-next-page
1748 "\177" gnus-article-goto-prev-page 1752 "\177" gnus-article-goto-prev-page
1753 [backspace] gnus-article-goto-prev-page
1749 [delete] gnus-article-goto-prev-page 1754 [delete] gnus-article-goto-prev-page
1750 "\C-c^" gnus-article-refer-article 1755 "\C-c^" gnus-article-refer-article
1751 "h" gnus-article-show-summary 1756 "h" gnus-article-show-summary
1752 "s" gnus-article-show-summary 1757 "s" gnus-article-show-summary
1753 "\C-c\C-m" gnus-article-mail 1758 "\C-c\C-m" gnus-article-mail