8

I am using BBDB3 with Gnus. I want to make BBDB to update the recipient address in its database for each mail I send (just like Gmail does). Is it possible?

5

Certainly, this is Emacs ! :)

(bbdb-initialize 'gnus 'message)
(bbdb-mua-auto-update-init 'message) ;; use 'gnus for incoming messages too
(setq bbdb-mua-auto-update-p 'query) ;; or 'create to create without asking

This will parse fields in outgoing messages, and suggest creation of corresponding BBDB entries

  • That makes it too intrusive especially while reading a news group. I don't want bbdb act on incoming messages but for only messages that I send. Looking for some kind of message-sent-hook? – kindahero Sep 24 '14 at 14:02
  • well that's the reason why I did write (bbdb-mua-auto-update-init 'message) and not (bbdb-mua-auto-update-init 'message 'gnus). The former hooks into message-send-hook (only outgoing messages), while the latter hooks also into gnus-article-prepare-hook (all displayed articles, hence incoming ones too) – Sigma Sep 24 '14 at 14:06
  • Thanks for explaining. But it doesn't seem to work. don't know why. I will test more and come back. – kindahero Sep 24 '14 at 14:21
  • I suggest you double-check the content of gnus-article-prepare-hook and eliminate any occurrence of bbdb-mua-auto-update (they might come from other parts of your config, most likely another call to bbdb-mua-auto-update-init) – Sigma Sep 24 '14 at 15:34
2

I don't have automatic but if you wanted to have it in a quick one key here how you can have that :

(defun my-gnus-bbdb-snarf-sender ()
  (interactive)
  (gnus-with-article-buffer
    (let ((from (mail-fetch-field "from")))
      (bbdb-snarf from 'mail))))

and add in a hook for gnus-summary-hook to a key, like for example :

(defun my-gnus-summary-mode-hook ()
  (local-set-key '[(\')] 'my-gnus-bbdb-snarf-sender))
(add-hook 'gnus-summary-mode-hook 'my-gnus-summary-mode-hook)

which bind it to the quote ' keyboard to add the sender directly to BBDB

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.