viewmail-info
[Top][All Lists]
Advanced

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

[VM] Bbdb3 configuration


From: rene
Subject: [VM] Bbdb3 configuration
Date: Fri, 11 May 2012 02:09:35 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Tim Cross <address@hidden> writes:

> Interesting. I briefly tried bbdb3 about 2 weeks ago. While it did
> seem to work in some areas, most of the time it just silently failed.
> For example, completing mail addresses from within VM buffers, adding
> notes, addning new records based on current message etc.
> 
> I'd also be interested in seeing any working configuration file. I
> really didn't have time to look at this in any depth - plan to when
> time permits, but no idea when that will be.

Here is my configuration file for bbdb3.  I still need to make vm-pcrisis fully
bbdb3 compliant.

;;;------------------------------------------------------------
(add-to-list 'load-path "/path/to/bbdb3/lisp")

;; Additionnal bbdb files not included in bbdb3 release: `bbdb-sc',
;; `bbdb-snarf', `new-vm-pcrisis', `bbdb-vcard', `bbdb-vcard-export',
;; etc.
(add-to-list 'load-path "/path/to/bbdb-contrib")

(require 'bbdb-loaddefs)
(require 'bbdb)

;;------------------------------------------------------------------
;; configuration for BBDB-3 when used without a MUA.
;;------------------------------------------------------------------

(add-to-list 'bbdb-address-format-list
             '(("Italy")
               "spcC" "@address@hidden @%c@ (%S)@\n%C@" "@%c@"))
(setq bbdb-default-country "Italy") 

(defun my-bbdb-edit-address-default (address)
  (let ((street (bbdb-edit-address-street (bbdb-address-streets address)))
        (postcode (bbdb-error-retry
                   (bbdb-parse-postcode
                    (bbdb-read-string "Postcode: " (bbdb-address-postcode 
address)))))
        (city (bbdb-read-string "City: " (bbdb-address-city address))))
    (list street
          city
          "" ; (bbdb-read-string "State:Spain " (bbdb-address-state address))
          postcode
          (bbdb-read-string "Country: " (or (bbdb-address-country address)
                                            bbdb-default-country)))))

(defun bbdb-edit-address-default (address)
   (my-bbdb-edit-address-default address))

(setq bbdb-phone-style nil)             ; free-style numbering plan

;;;-------------------------------------------------------------------
;;; Configuration for BBDB-3 when used with VM
;;;-------------------------------------------------------------------

(require 'bbdb-vm)
(bbdb-initialize 'vm 'mail)
(bbdb-mua-auto-update-init 'vm)
(setq bbdb-mail-user-agent 'vm-user-agent)

(add-hook 'mail-setup-hook 'bbdb-mail-aliases)
(setq bbdb-complete-mail-allow-cycling t)
(setq bbdb-mail-avoid-redundancy t)
(setq bbdb-accept-name-mismatch 0)
(setq bbdb-new-mails-always-primary t)

;; Automatically create BBDB entries for messages which do *not*
;; match the `bbdb-ignore-message-alist'
;(setq bbdb/mail-auto-create-p 'bbdb-ignore-some-messages-hook)
; !!!!! Ok with bbdb2 but not with BBDB3 !!!!!!

(setq bbdb-ignore-message-alist
      '(("From" .
         "SPAM\\|postmaster\\|MAILER-DAEMON\\|Sweep\\|Mail Delivery\\|Message
Delivery\\|Microsoft\\|Net Email\\|")) )

(setq bbdb-accept-message-alist nil)

;; To ignore new addresses in all folders except the `vm-primary-inbox'
;; or those matching `bbdb/vm-primary-inbox-regexp'
(setq bbdb-add-mails 'rf-bbdb/vm-ignore-old-addresses)

;;----------------------------
;; Piece stolen from `bbdb-rf'

(defcustom rf-bbdb/vm-primary-inbox-regexp
  (if (boundp 'vm-primary-inbox) vm-primary-inbox)
  "A regexp matching folder names of primary VM inboxes."
  :group 'bbdb-rf
  :type 'string)

(defun rf-bbdb/vm-ignore-old-folders ()
  "Hook for ignoring all folders except in-boxes.

Set `bbdb/mail-auto-create-p' to this function in order to ignore new
addresses in all folders except the `vm-primary-inbox' or those matching
`bbdb/vm-primary-inbox-regexp'."
  (interactive)
  (save-excursion
    (vm-select-folder-buffer)
    (if (and (string-match (or rf-bbdb/vm-primary-inbox-regexp
                               vm-primary-inbox)
                           (buffer-name))
             (bbdb-ignore-some-messages-hook))
        'prompt)))

(defun rf-bbdb/vm-ignore-old-addresses ()
  "Hook for ignoring all addresses except in in-boxes.

Set `bbdb-always-add-addresses' to this function in order to ignore new
addresses in all folders except the `vm-primary-inbox' or those matching
`bbdb/vm-primary-inbox-regexp'."
  (if (member major-mode '(vm-mode vm-virtual-mode vm-summary-mode
                                   vm-presentation-mode))
      (save-excursion
        (vm-select-folder-buffer)
        (if (string-match (or rf-bbdb/vm-primary-inbox-regexp
                              vm-primary-inbox)
                          (buffer-name))
            'ask                         ; ask the user
          nil                        ; do not add it
          ))
    nil))
;; End of piece stolen from `bbdb-rf'
;;-----------------------------------

; Automatically add some text to the notes field of the BBDB record
; corresponding to the current record based on the header of the
; current message.
(add-hook 'bbdb-notice-mail-hook 'bbdb-auto-notes)
(setq bbdb-auto-notes-rules
      (list
      ;; to save when I last received a message of that person
       '("Date"   (".*" lastmail 0 t))
       '("User-Agent"    (".*" mailer 0))
       '("X-Mailer"      (".*" mailer 0))
       '("X-Newsreader"  (".*" mailer 0))
        )) 

; For each record that has a 'vm-folder' attribute, add an element
; (email-regexp . folder) to the `vm-auto-folder-alist'.
;(bbdb/vm-set-auto-folder-alist)
; !!!!!!!!!!!! Absent from BBDB3 !!!!!!!!!!!!!!

;; I prefer to bind bbdb-complete-name to C-tab instead of M-tab as
;; under Linux this later key binding means "make next window active".
(define-key vm-mail-mode-map [(control tab)] 'bbdb-complete-mail)

;;;-----------------------------------------------------------------





reply via email to

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