From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/48434 Path: main.gmane.org!not-for-mail From: Michael Shields Newsgroups: gmane.emacs.gnus.general Subject: [PATCH] Use `banner' group parameter in addition to gnus-article-address-banner-alist Date: Tue, 31 Dec 2002 06:43:45 +0000 Organization: Mad Science Research Labs Sender: owner-ding@hpc.uh.edu Message-ID: <87r8byhen2.fsf@mulligatwani.msrl.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1041317036 12554 80.91.224.249 (31 Dec 2002 06:43:56 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 31 Dec 2002 06:43:56 +0000 (UTC) Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18TG7z-0003G0-00 for ; Tue, 31 Dec 2002 07:43:51 +0100 Original-Received: from sina.hpc.uh.edu ([129.7.128.10] ident=lists) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 18TG8N-0005TH-00; Tue, 31 Dec 2002 00:44:15 -0600 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Tue, 31 Dec 2002 00:45:05 -0600 (CST) Original-Received: from challah.msrl.com (challah.msrl.com [198.137.194.222]) by sina.hpc.uh.edu (8.9.3/8.9.3) with ESMTP id AAA16198 for ; Tue, 31 Dec 2002 00:44:45 -0600 (CST) Original-Received: (qmail 5144 invoked from network); 31 Dec 2002 06:43:46 -0000 Original-Received: from localhost (HELO mulligatwani.msrl.com) (127.0.0.1) by localhost with SMTP; 31 Dec 2002 06:43:46 -0000 Original-To: ding@hpc.uh.edu Original-Lines: 101 User-Agent: Gnus/5.090008 (Oort Gnus v0.08) XEmacs/21.4 (Military Intelligence, i386-debian-linux) Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:48434 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:48434 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 * 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.