Re: bbdbv3 and wanderlust

Rob Walker <[email protected]> Wed, 13 Sep 2017 21:59:26 -0700
Newsgroups gmane.mail.wanderlust.general
Message-ID <84a81xho41.wl-rob__46226.328801322$1505365267$gmane$org@ladle.net>
Thank you for your suggestions.  I will try them out as soon as I get
a chance.

On Wed, 13 Sep 2017 06:16:26 -0700,
Kazuhiro Ito wrote:
> 
> I am not user of bbdb, so below comments consist on only my thinking,
> not tested.

I understand how you cannot speak to software you aren't familiar
with, thank you for the review.  The bbdb code base has split out each
MUA into a separate file, and the one for Wanderlust is one of the
smallest and most concise.  I don't think you would find it difficult
to understand the code, it is only this one function that you have
already seen plus four define-key statements.  Look at bbdb-wl.el in
the directory that bbdb installs via the package system.

> > old file: ./.emacs.d/elpa/bbdb-20170725.300/bbdb-wl.el
> > new file: ./.emacs.d/elpa/bbdb-20170725.300/bbdb-wl-pristine.el
> > 39,42c39,43
> > <   (elmo-message-entity-field
> > <    (elmo-message-entity wl-summary-buffer-elmo-folder
> > <                         (wl-summary-message-number))
> > <    (intern (downcase header)) 'string))
> > ---
> > >   (with-current-buffer (get-buffer wl-summary-buffer-name)
> > >     (elmo-message-entity-field
> > >      (elmo-message-entity wl-summary-buffer-elmo-folder
> > >                         (wl-summary-message-number))
> > >      (intern (downcase header)) 'string)))
> 
> If you use sticky summary feature, summary buffer's name is not euqal
> to wl-summary-buffer-name.  Replacing bbdb/wl-header function with the
> below code should fix your problem.

Do you mean the wl-summary-always-sticky-folder-list variable?  That
is the only variable I can find of the form wl*sticky*.  Yes, I do set
that variable to t.

> (defun bbdb/wl-header (header)
>   (elmo-message-entity-field
>    (with-current-buffer (if (buffer-live-p wl-current-summary-buffer)
> 			    wl-current-summary-buffer
> 			  ;; Or signal some error.
> 			  (current-buffer))
>      (elmo-message-entity wl-summary-buffer-elmo-folder
> 			  (wl-summary-message-number)))
>    (intern (downcase header)) 'string))
> 
> If bbdb/wl-header can assume wl-current-summary-buffer always
> indicates non-killed buffer, we can use more simple code.  But I'm not
> sure.
> 
> (defun bbdb/wl-header (header)
>   (elmo-message-entity-field
>    (with-current-buffer wl-current-summary-buffer
>      (elmo-message-entity wl-summary-buffer-elmo-folder
> 			  (wl-summary-message-number)))
>    (intern (downcase header)) 'string))

I will test both methods.

> > old file: ./.emacs.d/elpa/wanderlust-20170627.2306/wl-summary.el
> > new file: ./.emacs.d/elpa/wanderlust-20170627.2306/wl-summary-pristine.el
> > 2173,2178c2173,2179
> > <   (save-excursion
> > <     (beginning-of-line)
> > <     (if (or (re-search-forward "\r\\(-?[0-9]+\\)" (point-at-eol) t)
> > <           (re-search-forward "^ *\\(-?[0-9]+\\)" (point-at-eol) t))
> > <       (string-to-number (wl-match-buffer 1))
> > <       nil)))
> > ---
> > >   (with-current-buffer (get-buffer wl-summary-buffer-name)
> > >     (save-excursion
> > >       (beginning-of-line)
> > >       (if (or (re-search-forward "\r\\(-?[0-9]+\\)" (point-at-eol) t)
> > >             (re-search-forward "^ *\\(-?[0-9]+\\)" (point-at-eol) t))
> > >         (string-to-number (wl-match-buffer 1))
> > >       nil))))
> 
> wl-summary-message-number is designed to be called from summary
> buffer.  If you really need that change, caller should be fixed.

I agree.  However, I didn't know what else to do.  I was getting a
"nil" returned to the wl-summary-message-number function when it was
being called with the redisplay-hook.

wl-message-redisplay-hook is a variable defined in ‘wl-vars.el’.
Its value is (bbdb-mua-auto-update)

Is this the correct place in Wanderlust to call BBDB?

Thanks,
Rob