Index: lisp/bbdb-gui.el
===================================================================
RCS file: /cvsroot/bbdb/bbdb/lisp/bbdb-gui.el,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- lisp/bbdb-gui.el	9 Jun 2003 12:29:53 -0000	1.32
+++ lisp/bbdb-gui.el	25 Jun 2003 15:58:06 -0000	1.33
@@ -321,8 +321,14 @@
              (bbdb-set-extent-property extent 'data 'bbdb))))))
 
 
-(defvar bbdb-user-menu-commands nil
-  "User defined menu entries which should be appended to the BBDB menu." )
+(defcustom bbdb-user-menu-commands nil
+  "User defined menu entries which should be appended to the BBDB menu.
+This should be a list of menu entries.
+When set to a fucntion the function gets called with two arguments the
+RECORD and the FIELD and it should either return nil or a list of menu
+entries."
+  :group 'bbdb-database
+  :type 'sexp)
 
 (defun build-bbdb-finger-menu (record)
   (let ((addrs (bbdb-record-finger-host record)))
@@ -444,8 +450,15 @@
         (list (build-bbdb-insert-field-menu record)))
     (if field
         (cons "-----" (build-bbdb-field-menu record field)))
-    bbdb-user-menu-commands)))
-
+    (if bbdb-user-menu-commands
+        (let ((menu (if (functionp bbdb-user-menu-commands)
+                        (funcall bbdb-user-menu-commands record field)
+                      bbdb-user-menu-commands)))
+          (if menu
+              (append ["-----"]
+                      ["User Defined Commands"]
+                      ["-----"]
+                      menu)))))))
 
 (eval-and-compile
   (if (fboundp 'popup-menu)
