Subject: Re: bug#20610: 25.0.50; Gnus fancy mail splitting not working anymore

From: Sebastien Vauban <[email-masked]>
Date: Fri, 22 May 2015 23:36:23 +0200

Sebastien Vauban <[email-masked]> writes:
> Katsumi Yamaoka <[email-masked]> writes:
>> On Tue, 19 May 2015 14:39:29 -0400, Stefan Monnier wrote:
>>> I think we need some help from the Gnus guys here,
>>
>> (featurep 'bbdb-gnus) ;; Type `C-j' at the end of the form.
>
> It _is_ loaded; it returns `t'.  [...]  Both versions of Emacs read my
> `~/.gnus' file and load the `bbdb-gnus' library found at
> `~/.emacs.d/elpa/bbdb-20140830.2031/bbdb-gnus.elc'.

I'm progressing -- a bit.  I just found out that, adding good ol'
messages, the conditional code is well executed (as already said)...

--8<---------------cut here---------------start------------->8---
  (message ">>> >>> %S <<< <<<" nnimap-split-methods)

  (when (require 'bbdb-gnus)

    (message ">>> >>> Inside! <<< <<<")

    ;; Split function to use (sorting mails into groups using BBDB).
    (setq nnimap-split-methods 'nnimap-split-fancy)

    ;; Specify how to split mail.
    (setq nnimap-split-fancy            ; vs `nnmail-split-fancy'?
          '(|                           ; Split to the *first* match.

              ;; Invoke BBDB.
              (: (lambda ()
                   (car (bbdb/gnus-split-method))))

              ;; Catch spam.
              ("X-Spam-Status" "[Yy]es"
               "INBOX.Spam")

              ;; Undecided.
              "INBOX"))

    ;; For records which don't have `gnus-private' set, the rules in
    ;; `split-fancy' are invoked.
    (setq bbdb/gnus-split-default-group nil))

    (message ">>> >>> %S <<< <<<" nnimap-split-methods)
--8<---------------cut here---------------end--------------->8---

gives:

--8<---------------cut here---------------start------------->8---
>>> >>> nil <<< <<<
>>> >>> Inside! <<< <<<
>>> >>> nnimap-split-fancy <<< <<<
--8<---------------cut here---------------end--------------->8---

... but, in Emacs 25.0, _after having started Gnus_, when I type `C-h
v nnimap-split-methods', I get `nil'!!!  And similarly for
`nnimap-split-fancy'... So, these variables gets reinitialized after my
code is run...  How?  Why?

In Emacs 25, if I reevaluate the above 2 vars (`nnimap-split-methods'
and `nnimap-split-fancy'), the mail splitting is still not working,
though `B t' indicates it would go to the right mailbox!  Why??

Another difference with Emacs 24.5: for these 3 messages to be evaluated
correctly, I had to explicitly add a `require 'nnimap' before the first
call to `message'. Otherwise, I had an "Error in ~/.gnus:
nnimap-split-methods"... Why is the variable not defined (I guess it
means that) in Emacs 24.5 and well in Emacs 25 -- without the explicit
call to nnimap?

Do the above ring a bell to someone?

I've seen that the nnimap vars are defined thru `defvoo' calls. I wasn't
aware of such a macro, and don't know yet its real effects...

Best regards,
  Seb

-- 
Sebastien Vauban