On Friday, September 6, 2002 at 14:46:30, Jason Haslup wrote:
> Hi folks,
> 
> I'm using bbdb with vm and specifically
> bbdb/vm-set-auto-folder-alist.  I'd like to set the vm-folder field
> for one of my contacts to execute a function that I've defined.  The
> documentation for bbdb/vm-set-auto-folder-alist states that I can set
> the first character of the vm-folder field to a quote and the rest of
> the field will be evaluated.
> 
> I've tried doing this, but I guess I don't understand what it
> means... I would think:
> 
> vm-folder: '(my-test)
> 
> Would run the function "my-test" (which just returns a string).
> However, VM complains because that entry in vm-auto-folder-alist looks
> like: 
> 
>   ("john_doe@yahoo\\.com" quote
>    (my-test))
> 
> Where the other entries look like:
> 
>   ("jane_doe@yahoo\\.com" . "jane")
> 
> What am I doing wrong?  I'm sure it's something simple, but my head
> already hurts from banging it on my table...

Well I am afraid it was never working as supposed to be ...
could you apply this patch and check if it works now for you?

Bye Robert

Index: bbdb-vm.el
===================================================================
RCS file: /cvsroot/bbdb/bbdb/lisp/bbdb-vm.el,v
retrieving revision 1.96
diff -b -c -r1.96 bbdb-vm.el
*** bbdb-vm.el  18 Apr 2002 12:10:32 -0000      1.96
--- bbdb-vm.el  25 Sep 2002 14:14:40 -0000
***************
*** 264,270 ****
  (defun bbdb/vm-set-auto-folder-alist ()
    "Create a `vm-auto-folder-alist' according to the records in the bbdb.
  For each record that has a 'vm-folder' attribute, add an
! \(email-regexp .  folder) element to the `vm-auto-folder-alist'.
  
  The element gets added to the 'element-name' sublist of the
  `vm-auto-folder-alist'.
--- 264,270 ----
  (defun bbdb/vm-set-auto-folder-alist ()
    "Create a `vm-auto-folder-alist' according to the records in the bbdb.
  For each record that has a 'vm-folder' attribute, add an
! element (email-regexp . folder) to the `vm-auto-folder-alist'.
  
  The element gets added to the 'element-name' sublist of the
  `vm-auto-folder-alist'.
***************
*** 273,280 ****
  bbdb record concatenated with OR; the cdr is the value of the
  vm-folder attribute.
  
! If the first character of vm-folders value is a quote (') it will be
! parsed as lisp expression and is evaluated to return a folder name."
    (interactive)
    (let* (;; we add the email-address/vm-folder-name pair to this
           ;; sublist of the vm-auto-folder-alist variable
--- 273,282 ----
  bbdb record concatenated with OR; the cdr is the value of the
  vm-folder attribute.
  
! If the first character of vm-folders value is a quote ' it will be
! parsed as lisp expression and is evaluated to return a folder name,
! e.g. define you own function `my-folder-name' and set it to
!         '(my-folder-name)"
    (interactive)
    (let* (;; we add the email-address/vm-folder-name pair to this
           ;; sublist of the vm-auto-folder-alist variable
***************
*** 286,314 ****
           notes-field folder
           ;; a regexp matching all the email addresses from the bbdb
           ;; record
!          email-regexp)
  
!     (dolist (header headers)
        ;; create the folder-list in vm-auto-folder-alist if it doesn't exist
        (setq folder-list (assoc header vm-auto-folder-alist))
        (unless folder-list
          (setq vm-auto-folder-alist (cons (list header)
                                           vm-auto-folder-alist)
                folder-list (assoc header vm-auto-folder-alist)))
!       (dolist (record (bbdb-records))
!         (setq notes-field (bbdb-record-raw-notes record))
          (when (and (listp notes-field)
                     (setq folder (cdr (assq bbdb/vm-set-auto-folder-alist-field
                                             notes-field))))
            ;; quote all the email addresses for the record and join them
            ;; with OR
!           (setq email-regexp (regexp-opt (bbdb-record-net record)))
            (unless (or (zerop (length email-regexp))
                        (assoc email-regexp folder-list))
              ;; be careful: nconc modifies the list in place
              (if (equal (elt folder 0) ?\')
!                 (setq folder (read folder)))
!             (nconc folder-list (list (cons email-regexp folder)))))))))
  
  
  ;;; bbdb/vm-auto-add-label
--- 288,334 ----
           notes-field folder
           ;; a regexp matching all the email addresses from the bbdb
           ;; record
!          email-regexp
!          ;;
!          records)
  
!     (setq records
!           (delete
!            nil
!            (mapcar (lambda (r)
!                      (let ((notes (bbdb-record-raw-notes r)))
!                        (if (and notes
!                                 (assq bbdb/vm-set-auto-folder-alist-field
!                                       notes))
!                            r
!                          nil)))
!                    (bbdb-records))))
!     
!     (while headers
!       (setq header (car headers) headers (cdr headers))
        ;; create the folder-list in vm-auto-folder-alist if it doesn't exist
        (setq folder-list (assoc header vm-auto-folder-alist))
        (unless folder-list
          (setq vm-auto-folder-alist (cons (list header)
                                           vm-auto-folder-alist)
                folder-list (assoc header vm-auto-folder-alist)))
!       (setq record records)
!       (mapcar
!        (lambda (r) 
!          (setq notes-field (bbdb-record-raw-notes r))
           (when (and (listp notes-field)
                      (setq folder (cdr (assq bbdb/vm-set-auto-folder-alist-field
                                              notes-field))))
            ;; quote all the email addresses for the record and join them
            ;; with OR
!            (setq email-regexp (regexp-opt (bbdb-record-net r)))
             (unless (or (zerop (length email-regexp))
                         (assoc email-regexp folder-list))
               ;; be careful: nconc modifies the list in place
               (if (equal (elt folder 0) ?\')
!                  (setq folder (read (substring folder 1))))
!              (nconc folder-list (list (cons email-regexp folder))))))
!        records))))
  
  
  ;;; bbdb/vm-auto-add-label



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Reply via email to