Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
From: Oleksandr Gavenko <gavenkoa@gmail.com>
To: info-gnus-english@gnu.org
Subject: Re: Score on same subject to avoid read message with this subject in future...
Date: Thu, 11 Apr 2013 00:14:52 +0300	[thread overview]
Message-ID: <87mwt6xf3n.fsf@gavenkoa.example.com> (raw)
In-Reply-To: <878v4uf1e4.fsf@gavenkoa.example.com>

On 2013-04-08, Oleksandr Gavenko wrote:

> So I try to implement killing by subject:
>
>   (defun my-gnus-summary-kill-same-subject (&optional unmark)
>     (interactive "P")
>     (when (or (not (integerp unmark)) (< 0 unmark))
>       (gnus-summary-score-entry
>        "subject" (gnus-simplify-subject-fuzzy (gnus-summary-article-subject))
>        's (- gnus-score-interactive-default-score) (current-time-string)))
>     (gnus-summary-kill-same-subject unmark))
>   (eval-after-load 'gnus-summary
>     '(define-key gnus-summary-mode-map (kbd "C-k") #'my-gnus-summary-kill-same-subject))
>
> I know about 'I' key binding but it require a lot of typing and attention...

My latest implementation:

  (defvar my-gnus-summary-kill-same-subject-min-len 8
    "Minimal length of subject string to ignore this subject.")
  (defun my-gnus-summary-kill-same-subject (&optional unmark)
    "Add negative scores for all articles with same subject."
    (interactive "P")
    (when (or (not (integerp unmark)) (< 0 unmark))
      (let ( (subj (gnus-simplify-subject-fuzzy (gnus-summary-article-subject))) )
        (when (<= (length subj) my-gnus-summary-kill-same-subject-min-len)
          (gnus-summary-score-entry
           "subject" subj
           's (- gnus-score-interactive-default-score) (current-time-string)))))
    (gnus-summary-kill-same-subject unmark))
  (eval-after-load 'gnus-sum
    '(define-key gnus-summary-mode-map (kbd "C-k") #'my-gnus-summary-kill-same-subject))

It like defadvice for 'gnus-summary-kill-same-subject' but only for key
binding...

Also I put limits for too short subjects to prevent false matches.

After using this function to group.SCORE file added entries like:

   ("subject"
    ("How to deal with \"Archive\" and \"delete\" in gmail?" -100 734966 s))

-- 
Best regards!

      parent reply	other threads:[~2013-04-10 21:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-07 21:59 Oleksandr Gavenko
2013-04-08 21:33 ` Oleksandr Gavenko
2013-04-10 20:32   ` Oleksandr Gavenko
2013-04-10 21:14 ` Oleksandr Gavenko [this message]

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=87mwt6xf3n.fsf@gavenkoa.example.com \
    --to=gavenkoa@gmail.com \
    --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).