From: Glenn Morris Date: Sat, 11 May 2013 02:25:11 +0000 (-0700) Subject: Make a few libraries loadable in isolation X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~2026^2~229^2~122 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=445f95e2ab112f211dcd66b048628f383f9363dd;p=emacs.git Make a few libraries loadable in isolation * lisp/calc/calc-menu.el: Make it loadable in isolation. * lisp/gnus/gnus-vm.el: Make it loadable without VM. (gnus-vm-make-folder, gnus-summary-save-in-vm): Require 'vm. (vm-forward-message, vm-reply, vm-mail): Remove unused autoloads. * lisp/net/eudcb-bbdb.el: Make it loadable without bbdb. (eudc-bbdb-filter-non-matching-record, eudc-bbdb-extract-phones) (eudc-bbdb-extract-addresses, eudc-bbdb-format-record-as-result) (eudc-bbdb-query-internal): Require 'bbdb. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fa835d5c6a9..9b112313d60 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,12 @@ 2013-05-11 Glenn Morris + * calc/calc-menu.el: Make it loadable in isolation. + + * net/eudcb-bbdb.el: Make it loadable without bbdb. + (eudc-bbdb-filter-non-matching-record, eudc-bbdb-extract-phones) + (eudc-bbdb-extract-addresses, eudc-bbdb-format-record-as-result) + (eudc-bbdb-query-internal): Require 'bbdb. + * lpr.el (lpr-headers-switches): * emacs-lisp/testcover.el (testcover-compose-functions): Fix :type. diff --git a/lisp/calc/calc-menu.el b/lisp/calc/calc-menu.el index ee98cc98c8f..5120528eaf4 100644 --- a/lisp/calc/calc-menu.el +++ b/lisp/calc/calc-menu.el @@ -1634,7 +1634,9 @@ (Info-goto-node "Help Commands"))]) "Menu for Calc's help functions.") -(defvar calc-mode-map) +;; Needed to make this file loadable in isolation. +;; Another option would be to use calc-load-hook. +(require 'calc) (easy-menu-define calc-menu diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index ea2bfa784d7..fba0cd8fea7 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,9 @@ +2013-05-11 Glenn Morris + + * gnus-vm.el: Make it loadable without VM. + (gnus-vm-make-folder, gnus-summary-save-in-vm): Require 'vm. + (vm-forward-message, vm-reply, vm-mail): Remove unused autoloads. + 2013-05-09 Glenn Morris * mml1991.el: Make it loadable. (Bug#13456) diff --git a/lisp/gnus/gnus-vm.el b/lisp/gnus/gnus-vm.el index fa39bae1763..55f99653cc4 100644 --- a/lisp/gnus/gnus-vm.el +++ b/lisp/gnus/gnus-vm.el @@ -35,12 +35,10 @@ (require 'gnus-msg) (eval-when-compile - (require 'cl) - (autoload 'vm-mode "vm") - (autoload 'vm-save-message "vm") - (autoload 'vm-forward-message "vm") - (autoload 'vm-reply "vm") - (autoload 'vm-mail "vm")) + (require 'cl)) + +(autoload 'vm-mode "vm") +(autoload 'vm-save-message "vm") (defvar gnus-vm-inhibit-window-system nil "Inhibit loading `win-vm' if using a window-system. @@ -51,10 +49,8 @@ Has to be set before gnus-vm is loaded.") (when window-system (require 'win-vm)))) -(when (not (featurep 'vm)) - (load "vm")) - (defun gnus-vm-make-folder (&optional buffer) + (require 'vm) (let ((article (or buffer (current-buffer))) (tmp-folder (generate-new-buffer " *tmp-folder*")) (start (point-min)) @@ -87,6 +83,7 @@ save those articles instead." (defun gnus-summary-save-in-vm (&optional folder) (interactive) + (require 'vm) (setq folder (gnus-read-save-file-name "Save %s in VM folder:" folder diff --git a/lisp/net/eudcb-bbdb.el b/lisp/net/eudcb-bbdb.el index 9f6dba703b1..d9d2aa5fe85 100644 --- a/lisp/net/eudcb-bbdb.el +++ b/lisp/net/eudcb-bbdb.el @@ -29,10 +29,10 @@ ;;; Code: (require 'eudc) -(if (not (featurep 'bbdb)) - (load-library "bbdb")) -(if (not (featurep 'bbdb-com)) - (load-library "bbdb-com")) + +;; Make it loadable on systems without bbdb. +(require 'bbdb nil t) +(require 'bbdb-com nil t) ;;{{{ Internal cooking @@ -71,6 +71,7 @@ (defun eudc-bbdb-filter-non-matching-record (record) "Return RECORD if it matches `eudc-bbdb-current-query', nil otherwise." + (require 'bbdb) (catch 'unmatch (progn (dolist (condition eudc-bbdb-current-query) @@ -112,6 +113,7 @@ (&optional dont-check-disk already-in-db-buffer)) (defun eudc-bbdb-extract-phones (record) + (require 'bbdb) (mapcar (function (lambda (phone) (if eudc-bbdb-use-locations-as-attribute-names @@ -123,6 +125,7 @@ (bbdb-record-phones record))) (defun eudc-bbdb-extract-addresses (record) + (require 'bbdb) (let (s c val) (mapcar (lambda (address) (setq c (bbdb-address-streets address)) @@ -146,6 +149,7 @@ (defun eudc-bbdb-format-record-as-result (record) "Format the BBDB RECORD as a EUDC query result record. The record is filtered according to `eudc-bbdb-current-return-attributes'" + (require 'bbdb) (let ((attrs (or eudc-bbdb-current-return-attributes '(firstname lastname aka company phones addresses net notes))) attr @@ -188,7 +192,7 @@ QUERY is a list of cons cells (ATTR . VALUE) where ATTRs should be valid BBDB attribute names. RETURN-ATTRS is a list of attributes to return, defaulting to `eudc-default-return-attributes'." - + (require 'bbdb) (let ((eudc-bbdb-current-query query) (eudc-bbdb-current-return-attributes return-attrs) (query-attrs (eudc-bbdb-format-query query))