Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
From: Tim Howe <vsync@quadium.net>
To: info-gnus-english@gnu.org
Subject: Re: spam.el: copy/move of ham articles from unclassified groups
Date: Sat, 21 Apr 2007 14:04:04 -0400	[thread overview]
Message-ID: <87wt05haej.fsf@rash.quadium.net> (raw)
In-Reply-To: <871widispy.fsf@rash.quadium.net>

Tim Howe <vsync@quadium.net> writes:

> I'm thinking what I will do is implement an interactive function which
> overrides the ! key in the raw groups.  It will remove all marks and
> move the article into nnml:misc.

For the record here is what I came up with:

(defun gnus-summary-unread-and-hammify-article ()
  (interactive)
  (gnus-summary-clear-mark-forward 1)
  (gnus-summary-move-article nil "nnml:misc"))

(defun gnus-summary-process-mark-all-extant ()
  (interactive)
  (save-excursion
    (let ((beg (point-min))
	  (end (point-max)))
      (goto-char beg)
      (while (< (point) end)
	(let ((article-number (gnus-summary-article-number)))
	  (unless (char= (gnus-summary-article-mark article-number) ?G)
	    (gnus-summary-set-process-mark article-number)))
	(forward-line 1))))
  (gnus-summary-position-point))

(defun gnus-summary-maybe-unread-and-hammify-article ()
  (interactive)
  (if (string-match "^nnml:raw\\(\\..*\\)?" gnus-newsgroup-name)
      (gnus-summary-unread-and-hammify-article)
      (gnus-summary-tick-article)))

(defun gnus-summary-mark-all-as-spam-and-exit ()
  (interactive)
  (when (gnus-y-or-n-p "Mark everything as spam? ")
    (gnus-uu-unmark-buffer)
    (gnus-summary-process-mark-all-extant)
    (dolist (article (gnus-summary-work-articles nil))
      (gnus-summary-goto-subject article)
      (gnus-summary-mark-as-spam 1))
    (gnus-uu-unmark-buffer)
    (gnus-summary-exit)))

(define-key gnus-summary-mode-map
  "!" 'gnus-summary-maybe-unread-and-hammify-article)
(define-key gnus-summary-mode-map
  "$" 'gnus-summary-mark-all-as-spam-and-exit)

(remove-hook 'gnus-get-top-new-news-hook 'spam-maybe-spam-stat-load)

-- 
vsync
http://quadium.net/~vsync/

The beauty of Amendment II is that it protects the ability to deal
with both a tyrannical government and a zombie apocalypse.
        -- Eochada,
           http://forums.fark.com/cgi/fark/comments.pl?IDLink=2749371

  reply	other threads:[~2007-04-21 18:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-21 16:43 Tim Howe
2007-04-21 18:04 ` Tim Howe [this message]
2007-07-06 17:04 ` Ted Zlatanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wt05haej.fsf@rash.quadium.net \
    --to=vsync@quadium.net \
    --cc=info-gnus-english@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).