Gnus development mailing list
 help / color / mirror / Atom feed
* [PATCH] Use `banner' group parameter in addition to gnus-article-address-banner-alist
@ 2002-12-31  6:43 Michael Shields
  2003-01-01 18:58 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Shields @ 2002-12-31  6:43 UTC (permalink / raw)


I sent this patch a few days ago, but mail.gnus.org ate it.

Currently Gnus ignores gnus-article-address-banner-alist if there is a
`banner' group parameter.  This is not what the documentation says,
and I think it is better here to change the code instead of the manual.

2002-12-21  Michael Shields  <shields@msrl.com>

	* gnus-art.el (article-strip-banner): Always pay attention to
	gnus-article-address-banner-alist, even if there is no `banner'
	group parameter.
	(article-really-strip-banner): New function.

--- /home/shields/gnus-CURRENT-20021216/lisp/gnus-art.el.orig	2002-12-31 06:42:11.000000000 +0000
+++ /home/shields/gnus-CURRENT-20021216/lisp/gnus-art.el	2002-12-31 06:42:11.000000000 +0000
@@ -2320,43 +2320,50 @@
 	     (match-beginning 0) (match-end 0) 'pem)))))))
 
 (defun article-strip-banner ()
-  "Strip the banner specified by the `banner' group parameter."
+  "Strip the banners specified by the `banner' group parameter and by
+`gnus-article-address-banner-alist'."
   (interactive)
   (save-excursion
     (save-restriction
+      (let ((inhibit-point-motion-hooks t))
+	(when (gnus-parameter-banner gnus-newsgroup-name)
+	  (article-really-strip-banner
+	   (gnus-parameter-banner gnus-newsgroup-name)))
+	(when gnus-article-address-banner-alist
+	  (article-really-strip-banner
+	   (let ((from (save-restriction
+			 (widen)
+			 (article-narrow-to-head)
+			 (mail-fetch-field "from"))))
+	     (when (and from
+			(setq from
+			      (caar (mail-header-parse-addresses from))))
+	       (catch 'found
+		 (dolist (pair gnus-article-address-banner-alist)
+		   (when (string-match (car pair) from)
+		     (throw 'found (cdr pair)))))))))))))
+
+(defun article-really-strip-banner (banner)
+  "Strip the banner specified by the argument."
+  (save-excursion
+    (save-restriction
       (let ((inhibit-point-motion-hooks t)
-	    (banner (gnus-parameter-banner gnus-newsgroup-name))
 	    (gnus-signature-limit nil)
-	    buffer-read-only beg end)
-	(when (and gnus-article-address-banner-alist
-		   (not banner))
-	  (setq banner
-		(let ((from (save-restriction
-			      (widen)
-			      (article-narrow-to-head)
-			      (mail-fetch-field "from"))))
-		  (when (and from
-			     (setq from
-				   (caar (mail-header-parse-addresses from))))
-		    (catch 'found
-		      (dolist (pair gnus-article-address-banner-alist)
-			(when (string-match (car pair) from)
-			  (throw 'found (cdr pair)))))))))
-	(when banner
-	  (article-goto-body)
-	  (cond
-	   ((eq banner 'signature)
-	    (when (gnus-article-narrow-to-signature)
-	      (widen)
-	      (forward-line -1)
-	      (delete-region (point) (point-max))))
-	   ((symbolp banner)
-	    (if (setq banner (cdr (assq banner gnus-article-banner-alist)))
-		(while (re-search-forward banner nil t)
-		  (delete-region (match-beginning 0) (match-end 0)))))
-	   ((stringp banner)
-	    (while (re-search-forward banner nil t)
-	      (delete-region (match-beginning 0) (match-end 0))))))))))
+	    buffer-read-only)
+	(article-goto-body)
+	(cond
+	 ((eq banner 'signature)
+	  (when (gnus-article-narrow-to-signature)
+	    (widen)
+	    (forward-line -1)
+	    (delete-region (point) (point-max))))
+	 ((symbolp banner)
+	  (if (setq banner (cdr (assq banner gnus-article-banner-alist)))
+	      (while (re-search-forward banner nil t)
+		(delete-region (match-beginning 0) (match-end 0)))))
+	 ((stringp banner)
+	  (while (re-search-forward banner nil t)
+	    (delete-region (match-beginning 0) (match-end 0)))))))))
 
 (defun article-babel ()
   "Translate article using an online translation service."

-- 
Shields.




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-01-01 22:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-31  6:43 [PATCH] Use `banner' group parameter in addition to gnus-article-address-banner-alist Michael Shields
2003-01-01 18:58 ` Lars Magne Ingebrigtsen
2003-01-01 19:59   ` Kai Großjohann
2003-01-01 20:03     ` Lars Magne Ingebrigtsen
2003-01-01 21:53   ` Michael Shields
2003-01-01 22:10     ` Lars Magne Ingebrigtsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).