branch: externals/bbdb commit b959fdd06d234a60b02079cd836ed1d50197d48e Author: Stefan Monnier <monn...@iro.umontreal.ca> Commit: Stefan Monnier <monn...@iro.umontreal.ca>
* bbdb-vm.el: Don't require VM when compiled. Trim the list of required packages from VM. * bbdb-gnus.el (bbdb-insinuate-gnus): * bbdb-vm.el (bbdb-insinuate-vm): Use defalias. --- bbdb-gnus.el | 18 +++++++++--------- bbdb-vm.el | 59 +++++++++++++++++++++++++++++++++-------------------------- 2 files changed, 42 insertions(+), 35 deletions(-) diff --git a/bbdb-gnus.el b/bbdb-gnus.el index c279c58..c2ac987 100644 --- a/bbdb-gnus.el +++ b/bbdb-gnus.el @@ -51,17 +51,17 @@ Do not call this in your init file. Use `bbdb-initialize'." ;; Set up user field for use in `gnus-summary-line-format' ;; (1) Big solution: use whole name (if bbdb-mua-summary-unify-format-letter - (fset (intern (concat "gnus-user-format-function-" - bbdb-mua-summary-unify-format-letter)) - (lambda (header) - (bbdb-mua-summary-unify (mail-header-from header))))) + (defalias (intern (concat "gnus-user-format-function-" + bbdb-mua-summary-unify-format-letter)) + (lambda (header) + (bbdb-mua-summary-unify (mail-header-from header))))) - ;; (2) Small solution: a mark for messages whos sender is in BBDB. + ;; (2) Small solution: a mark for messages whose sender is in BBDB. (if bbdb-mua-summary-mark-format-letter - (fset (intern (concat "gnus-user-format-function-" - bbdb-mua-summary-mark-format-letter)) - (lambda (header) - (bbdb-mua-summary-mark (mail-header-from header)))))) + (defalias (intern (concat "gnus-user-format-function-" + bbdb-mua-summary-mark-format-letter)) + (lambda (header) + (bbdb-mua-summary-mark (mail-header-from header)))))) (provide 'bbdb-gnus) diff --git a/bbdb-vm.el b/bbdb-vm.el index 07f158f..6fb9156 100644 --- a/bbdb-vm.el +++ b/bbdb-vm.el @@ -18,22 +18,29 @@ ;; along with BBDB. If not, see <http://www.gnu.org/licenses/>. ;;; Commentary: -;;; This file contains the BBDB interface to VM. -;;; See the BBDB info manual for documentation. +;; This file contains the BBDB interface to VM. +;; See the BBDB info manual for documentation. ;;; Code: (require 'bbdb) (require 'bbdb-com) (require 'bbdb-mua) -(require 'vm-autoloads) -(require 'vm-motion) -(require 'vm-summary) -(require 'vm-mime) -(require 'vm-vars) -(require 'vm-macro) -(require 'vm-message) -(require 'vm-misc) + +(when t ;Don't require during compilation, since VM might not be installed! + (require 'vm-autoloads) + (require 'vm-summary) + (require 'vm-mime) + (require 'vm-vars)) + +(declare-function vm-get-header-contents "vm-summary" + (message header-name-regexp &optional clump-sep)) +(declare-function vm-decode-mime-encoded-words-in-string "vm-mime" + (string)) +(declare-function vm-su-interesting-full-name "vm-summary" (m)) +(declare-function vm-su-from "vm-summary" (m)) +(defvar vm-message-pointer) ;In vm-vars +(defvar vm-mode-map) ;In vm-vars ;;;###autoload (defun bbdb/vm-header (header) @@ -61,25 +68,25 @@ Do not call this in your init file. Use `bbdb-initialize'." ;; Set up user field for use in `vm-summary-format' ;; (1) Big solution: use whole name (if bbdb-mua-summary-unify-format-letter - (fset (intern (concat "vm-summary-function-" - bbdb-mua-summary-unify-format-letter)) - (lambda (m) (bbdb-mua-summary-unify - ;; VM does not give us the original From header. - ;; So we have to work backwards. - (let ((name (vm-decode-mime-encoded-words-in-string - (vm-su-interesting-full-name m))) - (mail (vm-su-from m))) - (if (string= name mail) mail - (format "\"%s\" <%s>" name mail))))))) + (defalias (intern (concat "vm-summary-function-" + bbdb-mua-summary-unify-format-letter)) + (lambda (m) (bbdb-mua-summary-unify + ;; VM does not give us the original From header. + ;; So we have to work backwards. + (let ((name (vm-decode-mime-encoded-words-in-string + (vm-su-interesting-full-name m))) + (mail (vm-su-from m))) + (if (string= name mail) mail + (format "\"%s\" <%s>" name mail))))))) ;; (2) Small solution: a mark for messages whos sender is in BBDB. (if bbdb-mua-summary-mark-format-letter - (fset (intern (concat "vm-summary-function-" - bbdb-mua-summary-mark-format-letter)) - ;; VM does not give us the original From header. - ;; So we assume that the mail address is sufficient to identify - ;; the BBDB record of the sender. - (lambda (m) (bbdb-mua-summary-mark (vm-su-from m)))))) + (defalias (intern (concat "vm-summary-function-" + bbdb-mua-summary-mark-format-letter)) + ;; VM does not give us the original From header. + ;; So we assume that the mail address is sufficient to identify + ;; the BBDB record of the sender. + (lambda (m) (bbdb-mua-summary-mark (vm-su-from m)))))) (provide 'bbdb-vm)