info-gnus-english
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Archiving


From: Marco Parrone
Subject: Re: Archiving
Date: Tue, 24 May 2011 19:59:30 -0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Luzio <luzio@spam.nic> writes:

> Hello. I have a basic problem. I'm setting up my gnus newsreader and
> i'd like to have fine control over the archiving sent messages.
> Manual reads: 
>
>    Save to different groups based on what group you are in:
>      (setq gnus-message-archive-group
>            '(("^alt" "sent-to-alt")
>              ("mail" "sent-to-mail")
>              (".*" "sent-to-misc")))
>
>    More complex stuff:
>      (setq gnus-message-archive-group
>            '((if (message-news-p)
>                  "misc-news"
>                "misc-mail")))
>
>
> What i need is to archive the news messages only. So i wrote to my
> .gnus.el:
>
>      (setq gnus-message-archive-group
>            '((if (message-news-p)
>             '(("^alt" "sent-to-alt")
>              ("mail" "sent-to-mail")
>              (".*" "sent-to-misc"))
>                nil)))
>
> But i'm getting an error. Why?


Hi Luzio,

Here you can read the sources of the function which uses the
`gnus-message-archive-group' variable:

  http://git.gnus.org/cgit/gnus.git/tree/lisp/gnus-msg.el
  ...
  1681 | (defun gnus-inews-insert-gcc (&optional group)
  ...

If I've understood well the code, by setting
`gnus-message-archive-group' to a list containing a form (like you have
done), then the form is expected to evaluate to a string (or nil), while
your form evaluates to an association list.

You can obtain the behavior you want with this code instead:

(defun my-archiving-helper2 (group mylist)
  "Helper function for archiving my articles."
  (if (message-news-p)
      (if (string-match (car (car mylist)) group)
          (car (cdr (car mylist)))
        (my-archiving-helper2 group (cdr mylist)))
    nil))

(defun my-archiving-helper (group)
  "Helper function for archiving my articles."
  (my-archiving-helper2 group '(("^alt" "sent-to-alt")
                                ("mail" "sent-to-mail")
                                (".*" "sent-to-misc"))))

(setq gnus-message-archive-group
      'my-archiving-helper)

Goodbye,
Marco.

-- 
Marco Parrone <marco@marcoparrone.com>
PGP Key fingerprint = 5E21 BED2 BF47 B3FB F17F  1DB4 D9BE B2B7 3C3A 07E2


reply via email to

[Prev in Thread] Current Thread [Next in Thread]