bug-gnu-emacs
[Top][All Lists]
Advanced

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

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


From: Sebastien Vauban
Subject: Re: bug#20610: 25.0.50; Gnus fancy mail splitting not working anymore
Date: Fri, 24 Jul 2015 14:46:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (windows-nt)

Sebastien Vauban <sva-news@mygooglest.com> writes:
> Sebastien Vauban <sva-news@mygooglest.com> writes:
>> Katsumi Yamaoka <yamaoka@jpl.org> 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 [...] 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?

As I still need to read my mails within Emacs 25.0, and as the fancy
mail splitting still does not work for me there (while it does, with
the same config file, within Emacs 24.5), I have done more tests, adding
the following to my startup file:

--8<---------------cut here---------------start------------->8---
(defconst elt-require-depth 0 
  "Starting depth for load tree.") 

(defadvice require (around leuven-require activate)
  "Leave a trace of packages being loaded."
  (let* ((feature (ad-get-arg 0))
         (prefix-already (concat (make-string (* 4 elt-require-depth) ? ) "+-- 
"))
         (prefix-open    (concat (make-string (* 4 elt-require-depth) ? ) "+-> 
"))
         (prefix-close   (concat (make-string (* 4 elt-require-depth) ? ) "--> 
")))
    (cond ((featurep feature)
           (message "    [Value of `nnimap-split-methods' before requiring 
`%S': %s]" feature nnimap-split-methods)
           (message "%s%s <from %s>... already loaded"
                    prefix-already feature
                    (ignore-errors (file-name-base load-file-name)))
           (message "    [Value of `nnimap-split-methods' after requiring `%S': 
%s]" feature nnimap-split-methods)
           (setq ad-return-value feature))
          (t
           (message "%s%s <from %s>... %s"
                    prefix-open feature
                    (ignore-errors (file-name-base load-file-name))
                    (locate-library (symbol-name feature)))
           (message "    [Value of `nnimap-split-methods' before requiring 
`%S': %s]" feature nnimap-split-methods)
           (let ((elt-require-depth (1+ elt-require-depth)))
             ad-do-it)
           (message "    [Value of `nnimap-split-methods' after requiring `%S': 
%s]" feature nnimap-split-methods)
           (message "%s%s <from %s>... loaded"
                    prefix-close feature
                    (ignore-errors (file-name-base load-file-name)))))))
--8<---------------cut here---------------end--------------->8---

The effect, shown in both Emacs 24.5 and Emacs 25.0, is shown at the
screenshot http://screencast.com/t/akk7Mbx1q:

--8<---------------cut here---------------start------------->8---
+-- nntp <from nil>... already loaded
    [Value of `nnimap-split-methods' after requiring `nntp': nnimap-split-fancy]
Opening connection to mail via tls...
    [Value of `nnimap-split-methods' before requiring `tls': nil]
+-- tls <from network-stream>... already loaded
--8<---------------cut here---------------end--------------->8---

You can see that `nnimap-split-methods' gets reset to nil (in Emacs
25.0) somewhere between requiring `nntp' and "Opening connection to
<nnimap-address> via tls..." (function `nnimap-open-connection-1' in
`nnimap.el').  Why???

That must explain why no splitting is done on my mailbox.

Can anyone give me any hint on how to debug this further?  Please!  I'm
out of ideas on how to progress.

Best regards,
  Seb

PS- "Full" config being used:

--8<---------------cut here---------------start------------->8---
;;* Loading

(require 'gnus)
(require 'nnimap)

(defconst elt-require-depth 0 
  "Starting depth for emacs-load-time tree.") 

(defadvice require (around leuven-require activate)
  "Leave a trace of packages being loaded."
  (let* ((feature (ad-get-arg 0))
         (prefix-already (concat (make-string (* 4 elt-require-depth) ? ) "+-- 
"))
         (prefix-open    (concat (make-string (* 4 elt-require-depth) ? ) "+-> 
"))
         (prefix-close   (concat (make-string (* 4 elt-require-depth) ? ) "--> 
")))
    (cond ((featurep feature)
           (message "    [Value of `nnimap-split-methods' before requiring 
`%S': %s]" feature nnimap-split-methods)
           (message "%s%s <from %s>... already loaded"
                    prefix-already feature
                    (ignore-errors (file-name-base load-file-name)))
           (message "    [Value of `nnimap-split-methods' after requiring `%S': 
%s]" feature nnimap-split-methods)
           (setq ad-return-value feature)) ; set the return value in the case
                                        ; `ad-do-it' is not called
          (t
           (message "%s%s <from %s>... %s"
                    prefix-open feature
                    (ignore-errors (file-name-base load-file-name))
                    (locate-library (symbol-name feature)))
           (message "    [Value of `nnimap-split-methods' before requiring 
`%S': %s]" feature nnimap-split-methods)
           (let ((elt-require-depth (1+ elt-require-depth)))
             ad-do-it)
           (message "    [Value of `nnimap-split-methods' after requiring `%S': 
%s]" feature nnimap-split-methods)
           (message "%s%s <from %s>... loaded"
                    prefix-close feature
                    (ignore-errors (file-name-base load-file-name)))))))

;;* Starting Gnus

  (message "Starting Gnus...")

  ;; Support for `.authinfo' file.
  (when (try-require 'auth-source)

    ;; Log debug messages.
    (setq auth-source-debug t))

  ;; Configure incoming mail.
  (setq gnus-select-method
        '(nnimap "mail"
                 (nnimap-address "mail")
                 (nnimap-server-port 993)
                 (nnimap-stream ssl)))

  ;; Using Gnus for news.
  (setq gnus-secondary-select-methods
        '((nntp "gmane"
                (nntp-address "news.gmane.org"))
          (nntp "eternal-september"
                (nntp-address "news.eternal-september.org"))))

;; Gnus will not check for new newsgroups at startup.
  (setq gnus-check-new-newsgroups nil)

  ;; Don't save the list of killed groups.
  (setq gnus-save-killed-list nil)

  ;; Don't save a `.newsrc' file (for using other newsreaders) on exit.
  (setq gnus-save-newsrc-file nil)      ; Speed-up.

  ;; Ignore the `.newsrc' file.
  (setq gnus-read-newsrc-file nil)      ; Speed-up.

  ;; My `.newsrc' file (and the derived .el/.eld files).
  (setq gnus-startup-file (concat gnus-directory ".newsrc"))

  ;; Enable showing of [Gmail]/* groups.
  (setq gnus-ignored-newsgroups "")

  ;; Unconditionally read the dribble file.
  (setq gnus-always-read-dribble-file t)

  ;;  Gnus will only know about the groups in my `.newsrc' file
  (setq gnus-read-active-file nil)  ; speed-up

  (message "Starting Gnus... Done")

;;* Select Methods

  (message "6 Select Methods...")

  ;; Name(s) of IMAP mailboxes to split mail from.
  (setq nnimap-inbox "INBOX")           ; Necessary for splitting under 24.5.

  ;; The first match in `nnmail-split-rule' found will be used.
  (setq nnmail-crosspost nil)

  ;; BBDB (Big Brother DataBase) is loaded from my `.emacs' file.
  (when (try-require 'bbdb-gnus)

    ;; 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            ; XXX vs `nnmail-split-fancy'?
          '(|                           ; Split to the *first* match.

              ;; Mailing lists (in To: or Cc:).
              (to "foo@bar\\.com" "list.foo")

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

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

              ;; Unmatched mail goes to the catch-all group (default mailbox).
              "INBOX"))                 ; Undecided.

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


reply via email to

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