Discussion:
[VM] Bbdb3 and vm-pcrisis
rene
2012-05-07 13:29:08 UTC
Permalink
VM seems to be working alright with BBDB3. But I can't seem to make vm-pcrisis
work since functions like `bbdb-get-field' or `bbdb-record-putprop' don't exist
anymore.

Has anyone already upgraded vm-pcrisis from bbdb2 to bbdb3?

--
rene
rene
2012-05-07 19:10:15 UTC
Permalink
Post by rene
VM seems to be working alright with BBDB3. But I can't seem to make vm-pcrisis
work since functions like `bbdb-get-field' or `bbdb-record-putprop' don't exist
anymore.
Has anyone already upgraded vm-pcrisis from bbdb2 to bbdb3?
Apparently these functions should be replaced by `bbdb-record-get-field' and
`bbdb-record-set-field'.

I've updated http://www.emacswiki.org/emacs/UpgradeBBDB accordingly and added
about 20 new items.

Now I've managed to have vm and vm-pcrisis work with BBDB3 about 80% of the
time. But I still need to correct the remaining 20%.

In case someone has a fully working bbdb3 + vm configuration file, I'd be
interested in having a look at it.

--
Tim Cross
2012-05-08 22:36:05 UTC
Permalink
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.

Tim
Post by rene
VM seems to be working alright with BBDB3.  But I can't seem to make vm-pcrisis
work since functions like `bbdb-get-field' or `bbdb-record-putprop' don't exist
anymore.
Has anyone already upgraded vm-pcrisis from bbdb2 to bbdb3?
Apparently these functions should be replaced by `bbdb-record-get-field' and
`bbdb-record-set-field'.
I've updated http://www.emacswiki.org/emacs/UpgradeBBDB accordingly and added
about 20 new items.
Now I've managed to have vm and vm-pcrisis work with BBDB3 about 80% of the
time.  But I still need to correct the remaining 20%.
In case someone has a fully working bbdb3 + vm configuration file, I'd be
interested in having a look at it.
--
--
Tim Cross
rene
2012-05-11 02:09:35 UTC
Permalink
Post by Tim Cross
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" "@%s\n@%p @%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)

;;;-----------------------------------------------------------------
Tim Cross
2012-05-21 02:28:28 UTC
Permalink
HI Rene,

thanks for that. It seems there is a lot more to be done when using
bbdb3 than when using 2.x. I'll need to digest the differences and
work out what I need etc.

thanks,

Tim
Post by Tim Cross
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")
(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)
;;;-----------------------------------------------------------------
--
Tim Cross
Loading...