1

I set up nnmail-split-methods to separate mail coming from my mailing list from anything else:

(setq nnmail-split-methods '(("vladimir.lenin" "From:.*vladimir\.lenin")
                             ("mail.misc" "")))

New mail will now appear in vladimir.lenin group, but the already existing ones will still remain at mail.misc. How do i quickly move all articles matching the regex from one group to another?

2 Answers 2

1

This is my probably excess and sub-optimal solution, as i couldn't find the idiomatic way. Default keybindings for every command are given in parentheses.

First of all, set the variable gnus-move-split-methods similar to your nnmail-split-methods variable. Notice that the syntax in the 1st variable is ("^From:.*eliezer" "mail.hpmor"), while in the 2nd variable is ("mail.hpmor" "^From:.*eliezer"). For example, my gnus-move-split-methods is:

(setq gnus-move-split-methods
      '(("^Sender:.*abbie.*" "mail.abbie")
        ("" "mail.misc")))

Open the group and make it show all articles. Call gnus-summary-limit-to-headers (/ h) and specify regex (in my example "Sender:.*abbie") to show only articles you want to move.

Use keyboard macros to facilitate moving, start macro by kmacro-start-macro (C-x (), then move your first article with gnus-summary-move-article B m, then repeat the macro by kmacro-end-and-call-macro (C-x e) and specify the number of repetitions with a universal argument (C-u).

If you don't know how many times you should repeat the macro, you can count the number of articles left by selecting all (mark-whole-buffer) and counting with count-words-region. Don't use 0 as a universal article, as for some reason it won't finish. Remember, as mails are moved physically from one folder to another, the whole operation might take time depending on how many mail you have.

If you use nnml as a mail backend, run gnus-group-compact-group (G z) on your group, so that Gnus gives you the correct article count. This also may take time depending on the amount of mail.

Notes:

  • As you see, because you set gnus-move-split-methods, when you move the article, the default group proposed in the prompt is correct.
  • gnus-summary-toggle-header (t) is helpful to find which header you need to filter with.
  • Sometimes there is no Sender: header, so I use Cc:.*abbie regexp too. You might see that headers are frequently inconsistent, so be careful.
0

From the summary buffer of the mail.misc group, limit the view to the articles whose author is "vladimir.lenin" (gnus-summary-limit-to-author), then mark them all for processing (gnus-uu-mark-all), and then move all the marked articles to the vladimir.lenin group (gnus-summary-move-article). The complete key sequence is as follows:

/ a vladimir\.lenin RET M P a B m vladimir.lenin RET / w

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .