* [PATCH] Strip banners based on both user address and group (resend)
@ 2003-02-12 17:59 Michael Shields
2003-02-12 20:23 ` Kai Großjohann
0 siblings, 1 reply; 4+ messages in thread
From: Michael Shields @ 2003-02-12 17:59 UTC (permalink / raw)
Resending now that I have papers on file.
Currently, if you've defined a banner in the group parameters,
`gnus-article-address-banner-alist' will be ignored. This patch
corrects that.
(It looks like a big patch, but it's mostly indentation change.)
2003-02-12 Michael Shields <shields@msrl.com>
* gnus-art.el (article-strip-banner): Strip both per-group and
per-user-address banners.
(article-really-strip-banner): New.
Index: lisp/gnus-art.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-art.el,v
retrieving revision 6.293
diff -u -r6.293 gnus-art.el
--- lisp/gnus-art.el 12 Feb 2003 15:06:16 -0000 6.293
+++ lisp/gnus-art.el 12 Feb 2003 18:03:15 -0000
@@ -2299,43 +2301,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] 4+ messages in thread
* Re: [PATCH] Strip banners based on both user address and group (resend)
2003-02-12 17:59 [PATCH] Strip banners based on both user address and group (resend) Michael Shields
@ 2003-02-12 20:23 ` Kai Großjohann
2003-02-12 23:38 ` Michael Shields
0 siblings, 1 reply; 4+ messages in thread
From: Kai Großjohann @ 2003-02-12 20:23 UTC (permalink / raw)
I hope I committed this one, too. Could you check?
--
A turnip curses Elvis
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Strip banners based on both user address and group (resend)
2003-02-12 20:23 ` Kai Großjohann
@ 2003-02-12 23:38 ` Michael Shields
2003-02-13 11:28 ` Kai Großjohann
0 siblings, 1 reply; 4+ messages in thread
From: Michael Shields @ 2003-02-12 23:38 UTC (permalink / raw)
Cc: ding
In article <841y2di6yp.fsf@lucy.is.informatik.uni-duisburg.de>,
kai.grossjohann@uni-duisburg.de (Kai Großjohann) wrote:
> I hope I committed this one, too. Could you check?
It looks like you committed the changelog entry, but not the patch.
How did that happen?
--
Shields.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Strip banners based on both user address and group (resend)
2003-02-12 23:38 ` Michael Shields
@ 2003-02-13 11:28 ` Kai Großjohann
0 siblings, 0 replies; 4+ messages in thread
From: Kai Großjohann @ 2003-02-13 11:28 UTC (permalink / raw)
Michael Shields <shields@msrl.com> writes:
> In article <841y2di6yp.fsf@lucy.is.informatik.uni-duisburg.de>,
> kai.grossjohann@uni-duisburg.de (Kai Großjohann) wrote:
>> I hope I committed this one, too. Could you check?
>
> It looks like you committed the changelog entry, but not the patch.
> How did that happen?
I can't say how, but I can say why: I was quite tired. Sorry for the
mishap, and thanks for checking. I've now committed the patch, too.
(CVS complained about a checksum error. Maybe I was changing the
working directory while the "cvs ci" was in process -- I think that's
not a good thing to do.)
--
A turnip curses Elvis
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-02-13 11:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-12 17:59 [PATCH] Strip banners based on both user address and group (resend) Michael Shields
2003-02-12 20:23 ` Kai Großjohann
2003-02-12 23:38 ` Michael Shields
2003-02-13 11:28 ` Kai Großjohann
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).