Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* Help needed: nnmaildir and expire-group parameter.
@ 2022-11-26 22:11 Fernando de Morais
  2022-11-29 19:17 ` Eric Abrahamsen
  0 siblings, 1 reply; 6+ messages in thread
From: Fernando de Morais @ 2022-11-26 22:11 UTC (permalink / raw)
  To: info-gnus-english

Hello everyone,

According to the manual[1][2], `nnmaildir' uses its own group parameters
to handle expiration.

Excepting `nnmail-expiry-wait(-function)' variables, to handle
expiration per group, the user needs to set values for `expire-age' and
`expire-group' parameters.  Ok, so considering the snippet below:

#+begin_src emacs-lisp
  (customize-set-variable 'gnus-parameters
                          '("nnmaildir:inbox"
                            (expire-age . 0)		         ; <-- Here
                            (expire-group . "nnmaildir:trash"))) ; <-- Here
  (customize-set-variable 'gnus-secondary-select-methods
                          '((nntp "news.gwene.org")
                            (nnmaildir ""
                                       (directory "~/Mail/")
                                       (target-prefix "")
                                       (get-new-mail t))))
  (customize-set-variable 'gnus-select-method '(nnnil ""))
  (customize-set-variable 'gnus-total-expirable-newsgroups
                          (regexp-opt '("nnmaildir:trash")))
#+end_src

Unfortunately, the expired mail in `nnmaildir:inbox' does not move to
the `nnmaildir:trash' group, its stays, marked as expirable, in the
original one.

If I drop the `(expire-age . 0)' in favor of something like
`(expiry-wait . immediate)', which according to the manual will be
respected by `nnmaildir', instead of moving the mail to the configured
expiry group, it will delete it.

I tested defining an expiry group from another back end (thus from
another server); from another `nnmaildir' server; and tweaked
`expire-age'.  All this through, alternatively, the `gnus-parameters'
variable and from `gnus-group-edit-group-parameters' interface, but
without success.

So, what am I doing wrong?  Did I miss something?

Can anyone help me with this configuration?  I'll happily share any
further details about my actual settings, if needed.

Thanks in advance.


Footnotes:
[1]  (info "(gnus) nnmaildir Group Parameters")
[2]  (info "(gnus) Comparing Mail Back Ends")

-- 
Regards,
Fernando de Morais.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Help needed: nnmaildir and expire-group parameter.
  2022-11-26 22:11 Help needed: nnmaildir and expire-group parameter Fernando de Morais
@ 2022-11-29 19:17 ` Eric Abrahamsen
  2022-11-29 19:21   ` Emanuel Berg
  2022-11-29 21:59   ` Fernando de Morais
  0 siblings, 2 replies; 6+ messages in thread
From: Eric Abrahamsen @ 2022-11-29 19:17 UTC (permalink / raw)
  To: Fernando de Morais; +Cc: info-gnus-english

Fernando de Morais <fernando.morais@academico.ifpb.edu.br> writes:

> Hello everyone,
>
> According to the manual[1][2], `nnmaildir' uses its own group parameters
> to handle expiration.
>
> Excepting `nnmail-expiry-wait(-function)' variables, to handle
> expiration per group, the user needs to set values for `expire-age' and
> `expire-group' parameters.  Ok, so considering the snippet below:
>
> #+begin_src emacs-lisp
>   (customize-set-variable 'gnus-parameters
>                           '("nnmaildir:inbox"
>                             (expire-age . 0)		         ; <-- Here
>                             (expire-group . "nnmaildir:trash"))) ; <-- Here
>   (customize-set-variable 'gnus-secondary-select-methods
>                           '((nntp "news.gwene.org")
>                             (nnmaildir ""
>                                        (directory "~/Mail/")
>                                        (target-prefix "")
>                                        (get-new-mail t))))
>   (customize-set-variable 'gnus-select-method '(nnnil ""))
>   (customize-set-variable 'gnus-total-expirable-newsgroups
>                           (regexp-opt '("nnmaildir:trash")))
> #+end_src

A quick check you can do is to evaluate (after Gnus has loaded):

(nnmaildir--param "nnmaildir:inbox" 'expire-age)

And see what that gives you. I'm not entirely sure that
"nnmaildir:inbox" is correct, and I wonder if the problem you're seeing
comes from the fact that your nnmaildir server has a blank string for a
name.

The real check would be to edebug `nnmaildir-request-expire-articles'
and see what it's doing. You may already be familiar with edebug; if not
then put point inside that function and hit "C-u C-M-x". The next time
expiry runs the process will halt and display this function, and you can
step through it with <SPC>. As point passes over various sexps, their
return value will be shown in the minibuffer. Look for the value of
"pgname", and the 'expire-age parameter, and later the 'expire-group
parameter. Something in there should jump out at you as "wrong".

(Apologies if you already know edebug.)

Eric


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Help needed: nnmaildir and expire-group parameter.
  2022-11-29 19:17 ` Eric Abrahamsen
@ 2022-11-29 19:21   ` Emanuel Berg
  2022-11-29 21:59   ` Fernando de Morais
  1 sibling, 0 replies; 6+ messages in thread
From: Emanuel Berg @ 2022-11-29 19:21 UTC (permalink / raw)
  To: info-gnus-english

Eric Abrahamsen wrote:

> Apologies if you already know edebug.

It's okay ...

-- 
underground experts united
https://dataswamp.org/~incal



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Help needed: nnmaildir and expire-group parameter.
  2022-11-29 19:17 ` Eric Abrahamsen
  2022-11-29 19:21   ` Emanuel Berg
@ 2022-11-29 21:59   ` Fernando de Morais
  2022-11-30 17:16     ` Eric Abrahamsen
  1 sibling, 1 reply; 6+ messages in thread
From: Fernando de Morais @ 2022-11-29 21:59 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: info-gnus-english

Hello Eric,

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Look for the value of "pgname", and the 'expire-age parameter, and
> later the 'expire-group parameter. Something in there should jump out
> at you as "wrong".

This was a very wise advice: in the end, `nnmaildir' was looking for the
parameters of the group "inbox", not "nnmaildir:inbox".  That did the
trick!  🎉

So, the customization of `gnus-parameters' would be:

#+begin_src emacs-lisp
  (customize-set-variable 'gnus-parameters
                          '(("inbox"
                             (expire-age . 0)
                             (expire-group . "nnmaildir:trash"))))
#+end_src

> (Apologies if you already know edebug.)

Don't worry about that.  You saved the day once more!

Thank you very much!


*P.S.:* I imagine there must be a rationale behind this and it was
defined a long time ago, but why doesn't `nnmaildir' make use of the
`expiry-target' parameter like other backends do?

-- 
Regards,
Fernando de Morais.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Help needed: nnmaildir and expire-group parameter.
  2022-11-29 21:59   ` Fernando de Morais
@ 2022-11-30 17:16     ` Eric Abrahamsen
  2022-11-30 18:19       ` Fernando de Morais
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Abrahamsen @ 2022-11-30 17:16 UTC (permalink / raw)
  To: Fernando de Morais; +Cc: info-gnus-english

Fernando de Morais <fernandodemorais.jf@gmail.com> writes:

> Hello Eric,
>
> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Look for the value of "pgname", and the 'expire-age parameter, and
>> later the 'expire-group parameter. Something in there should jump out
>> at you as "wrong".
>
> This was a very wise advice: in the end, `nnmaildir' was looking for the
> parameters of the group "inbox", not "nnmaildir:inbox".  That did the
> trick!  🎉

[...]

> Thank you very much!

Glad it wasn't any harder to resolve!

> *P.S.:* I imagine there must be a rationale behind this and it was
> defined a long time ago, but why doesn't `nnmaildir' make use of the
> `expiry-target' parameter like other backends do?

Apparently it's not using the same parameter names as everyone else,
because nnmaildir lets the user put arbitrary Lisp expressions in as
values -- it runs the values through `eval' at Gnus startup time. I
think the idea is that, because the parameter values are handled
differently, the parameter names should be different.

This doesn't particularly make sense, and the use of `eval' in regular
code is pretty heavily discouraged these days. This code seems to have
been in nnmaildir.el since The Dawn of Time, and I'm sure that at one
point someone depended heavily on being able to `eval' their parameter
values.

It would be relatively simple to fix: we could leave the existing
handling of nnmaildir's own parameters in place, but also start
retrieving the normal expiry parameters, using Gnus' regular
`gnus-group-parameter-*' functions.

Eric


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Help needed: nnmaildir and expire-group parameter.
  2022-11-30 17:16     ` Eric Abrahamsen
@ 2022-11-30 18:19       ` Fernando de Morais
  0 siblings, 0 replies; 6+ messages in thread
From: Fernando de Morais @ 2022-11-30 18:19 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: info-gnus-english

Hello Eric,

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Apparently it's not using the same parameter names as everyone else,
> because nnmaildir lets the user put arbitrary Lisp expressions in as
> values -- it runs the values through `eval' at Gnus startup time. I
> think the idea is that, because the parameter values are handled
> differently, the parameter names should be different.
>
> This doesn't particularly make sense, and the use of `eval' in regular
> code is pretty heavily discouraged these days. This code seems to have
> been in nnmaildir.el since The Dawn of Time, and I'm sure that at one
> point someone depended heavily on being able to `eval' their parameter
> values.

Understood.

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> It would be relatively simple to fix: we could leave the existing
> handling of nnmaildir's own parameters in place, but also start
> retrieving the normal expiry parameters, using Gnus' regular
> `gnus-group-parameter-*' functions.

I'm glad to know that the implementation would be more or less
simple. I'll check the `gnus-group-parameter-*' functions and try to
play with `nnmaildir' with this idea in mind.

Thanks!

-- 
Regards,
Fernando de Morais.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-11-30 18:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-26 22:11 Help needed: nnmaildir and expire-group parameter Fernando de Morais
2022-11-29 19:17 ` Eric Abrahamsen
2022-11-29 19:21   ` Emanuel Berg
2022-11-29 21:59   ` Fernando de Morais
2022-11-30 17:16     ` Eric Abrahamsen
2022-11-30 18:19       ` Fernando de Morais

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).