Skip to content

Question 6.2 ​

How to archive interesting messages?

Answer ​

If you stumble across an interesting message, say in gnu.emacs.gnus and want to archive it there are several solutions. The first and easiest is to save it to a file by saying O f. However, wouldn’t it be much more convenient to have more direct access to the archived message from Gnus? If you say yes, put this snippet by Frank Haun <pille3003@fhaun.de> in ~/.gnus.el:

emacs-lisp
(defun my-archive-article (&optional n)
  "Copies one or more article(s) to a corresponding `nnml:' group, e.g.,
`gnus.ding' goes to `nnml:1.gnus.ding'.  And `nnml:List-gnus.ding' goes
to `nnml:1.List-gnus-ding'.

Use process marks or mark a region in the summary buffer to archive
more then one article."
  (interactive "P")
  (let ((archive-name
         (format
          "nnml:1.%s"
          (replace-regexp-in-string "^.*:" "" gnus-newsgroup-name))))
    (gnus-summary-copy-article n archive-name)))

You can now say M-x my-archive-article in summary buffer to archive the article under the cursor in a nnml group. (Change nnml to your preferred back end.)

Of course you can also make sure the cache is enabled by saying

emacs-lisp
(setq gnus-use-cache t)

then you only have to set either the tick or the dormant mark for articles you want to keep, setting the read mark will remove them from cache.