girzel / ebdb

An EIEIO port of BBDB, Emacs' contact-management package
67 stars 12 forks source link

Wanderlust Error Message #95

Closed sidhu1f closed 3 years ago

sidhu1f commented 3 years ago

Just started with EBDB, its mostly been a pleasant experience using it with WL. Thanks for writing the code, and the manual.

The only issue I face is in the WL summary buffer. Whenever I press enter or space to view the message body, the error message "EBDB does not support wl-summary-mode" appears in the minibuffer. Curiously, EBDB and WL functionality seems unaffected.

I'm using version 0.6.21 installed via ELPA. I have looked through the EBDB source but the issue remains unclear. Would appreciate help identifying the cause of the error message.

girzel commented 3 years ago

I'm glad that EBDB is (otherwise) working okay!

That error is caused by EBDB code trying to run ebdb-mua-message-header (to extract the value of one header from the message) while in a mode that doesn't support it. Right now there's only one method defined, to work in mime-view-mode, and there needs to be another for wl-summary-mode.

I don't know wl very well -- can you tell me what mime-view-mode is for? Maybe we don't need that definition at all. Basically, there need to be methods defined for whatever buffer/major-mode is active at the moment EBDB is called on to find relevant records and display them. It looks like that happens on the wl-summary-redisplay-hook, which makes it sound like wl-summary-mode is probably the mode we're in.

(I'm actually a little surprised that it works right now -- EBDB is able to correctly find and display the senders/recipients of the message you open for viewing?)

girzel commented 3 years ago

Maybe try eval'ing this and see if it fixes the problem? (I guess what I mean to say is, the below will almost certainly fix the problem, but I don't know if I can get rid of the other mime-view-mode definition.)

(cl-defmethod ebdb-mua-message-header ((header string)
                       &context (major-mode wl-summary-mode))
  "Extract a message header in Wanderlust."
  (elmo-message-entity-field
   ;; It's possibly not safe to assume `wl-current-summary-buffer' is live?
   (with-current-buffer wl-current-summary-buffer
     (elmo-message-entity wl-summary-buffer-elmo-folder
              (wl-summary-message-number)))
   (intern (downcase header)) 'string))
sidhu1f commented 3 years ago

Evaluating elisp you provided does fix the error message. As is typical, in WL also the top pane displays the list of mails (one per line) while the bottom pane displays the body of the current mail. The former pane uses wl-summary-mode while the latter uses mime-view-mode. The ebdb keymap prefix ";" works only in the former, in the latter it results in a "Buffer is read only" message.

I can confirm that before applying your code fix, I could use ";:" to create a new EBDB record from sender name and mail address, and then use TAB to complete the address while composing message. After applying your code fix, mail sender and recipients of current mail can be displayed. I can also create a common mail alias, name complete it and then expand it out into the list of mail addresses.

Also appreciate the organization record and well thought out details. Thanks for above and also the prompt reply.

girzel commented 3 years ago

Okay, sounds like it will be worthwhile defining methods for both modes. Would you ever want EBDB keybindings (the ";" prefix) in the message/mime buffer?

sidhu1f commented 3 years ago

I'm fine with EBDB keybindings only in the wl-summary buffer. Likely somewhat useful to have them in the message/mime buffer as well, especially If the EBDB pane now opens next to the message/mime buffer, which is typically much taller than the wl-summary buffer, enabling more info to be visible in the EBDB pane.

girzel commented 3 years ago

Okay, there goes. Please reopen if anything's still not working right.