I'm using BBDB version 1.49; 1-dec-93.
Apologies if this isn't the right list for bug reports. I didn't see
anything else mentioned in the info files.
The bbdb-insinuate-vm function doesn't seem to interact properly with
the autoloading present in VM 5.50. That function tries to overload
vm-record-and-change-message-pointer, whose definition at the time of
overloading is an autoload form. This means that the autoload gets
moved to bbdb-orig-vm-record-and-change-message-pointer; when it
actually gets called, vm-motion.elc gets loaded, scribbles all over
bbdb-insinuate-vm's insinuations, and then signals an error because
"autoloading failed to define bbdb-orig-vm-record-and-...".
I suppose the quick fix would simply be to (load-library "vm-motion")
at the top. But maybe there's a reason to prefer the patch below.
The new bbdb-autoload-p and bbdb-overload functions might also be
useful elsewhere in BBDB.
*** 1.1 1994/02/07 13:48:46
--- bbdb-vm.el 1994/02/07 14:10:10
*************** displaying the record corresponding to t
*** 126,131 ****
--- 126,159 ----
(prog1 (bbdb-orig-vm-record-and-change-message-pointer old new)
(bbdb/vm-update-record nil)))
+ (defun bbdb-autoload-p (function)
+ "Return non-nil if FUNCTION is an autoloaded function.
+ If non-nil, the return value is the file to load to define FUNCTION.
+ FUNCTION may be a symbol or another representation of a function, like
+ a bytecode object."
+ (setq function (indirect-function function))
+ (if (and (listp function)
+ (eq (car function) 'autoload)
+ (stringp (nth 1 function)))
+ (nth 1 function)))
+
+ (defun bbdb-overload (function new-function save-as)
+ "Set FUNCTION to run NEW-FUNCTION, and rename its old function to SAVE-AS.
+ All arguments should be symbols.
+
+ If FUNCTION is autoloaded, bbdb-overload performs the autoload before
+ tweaking FUNCTION's definition. If we leave the autoload until later,
+ it will undo the overloading, and set FUNCTION back to its original
+ definition.
+
+ If FUNCTION has no function definition, SAVE-AS is left unbound."
+ (let ((autoloaded (bbdb-autoload-p function)))
+ (if autoloaded (load autoloaded)))
+ (if (fboundp function)
+ (fset save-as (symbol-function function))
+ (fmakunbound save-as))
+ (fset function (symbol-function new-function)))
+
(defun bbdb-insinuate-vm ()
"Call this function to hook BBDB into VM."
(cond ((boundp 'vm-show-message-hook)
*************** displaying the record corresponding to t
*** 134,146 ****
;(bbdb-add-hook 'vm-preview-message-hook 'bbdb/vm-update-record)
)
(t
! ;; Hack on to vm-record-and-change-message-pointer, since VM 5.32
! ;; doesn't have vm-show-message-hook.
! (or (fboundp 'bbdb-orig-vm-record-and-change-message-pointer)
! (fset 'bbdb-orig-vm-record-and-change-message-pointer
! (symbol-function 'vm-record-and-change-message-pointer)))
! (fset 'vm-record-and-change-message-pointer
! (symbol-function 'bbdb/vm-record-and-change-message-pointer))
))
(define-key vm-mode-map ":" 'bbdb/vm-show-sender)
(define-key vm-mode-map ";" 'bbdb/vm-edit-notes)
--- 162,170 ----
;(bbdb-add-hook 'vm-preview-message-hook 'bbdb/vm-update-record)
)
(t
! (bbdb-overload 'vm-record-and-change-message-pointer
! 'bbdb/vm-record-and-change-message-pointer
! 'bbdb-orig-vm-record-and-change-message-pointer)
))
(define-key vm-mode-map ":" 'bbdb/vm-show-sender)
(define-key vm-mode-map ";" 'bbdb/vm-edit-notes)