diff options
| author | Richard M. Stallman | 2002-04-28 03:23:52 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-04-28 03:23:52 +0000 |
| commit | 8f772dfd7a4e2cc2e0fb0a9dad558b7852f16755 (patch) | |
| tree | 6c856470a55adb37af258bcdc2d31166df4108e6 | |
| parent | e8e98f20c2f0a346c5f43905d297ebe7169485f0 (diff) | |
| download | emacs-8f772dfd7a4e2cc2e0fb0a9dad558b7852f16755.tar.gz emacs-8f772dfd7a4e2cc2e0fb0a9dad558b7852f16755.zip | |
(custom-load-symbol): Moved from cus-edit.el.
(custom-load-recursion): Likewise.
| -rw-r--r-- | lisp/custom.el | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lisp/custom.el b/lisp/custom.el index cae8450c968..c12f3bec2e7 100644 --- a/lisp/custom.el +++ b/lisp/custom.el | |||
| @@ -457,6 +457,47 @@ LOAD should be either a library file name, or a feature name." | |||
| 457 | (unless (member load loads) | 457 | (unless (member load loads) |
| 458 | (put symbol 'custom-loads (cons (purecopy load) loads))))) | 458 | (put symbol 'custom-loads (cons (purecopy load) loads))))) |
| 459 | 459 | ||
| 460 | ;;; Loading files needed to customize a symbol. | ||
| 461 | ;;; This is in custom.el because menu-bar.el needs it for toggle cmds. | ||
| 462 | |||
| 463 | (defvar custom-load-recursion nil | ||
| 464 | "Hack to avoid recursive dependencies.") | ||
| 465 | |||
| 466 | (defun custom-load-symbol (symbol) | ||
| 467 | "Load all dependencies for SYMBOL." | ||
| 468 | (unless custom-load-recursion | ||
| 469 | (let ((custom-load-recursion t) | ||
| 470 | (loads (get symbol 'custom-loads)) | ||
| 471 | load) | ||
| 472 | (while loads | ||
| 473 | (setq load (car loads) | ||
| 474 | loads (cdr loads)) | ||
| 475 | (cond ((symbolp load) | ||
| 476 | (condition-case nil | ||
| 477 | (require load) | ||
| 478 | (error nil))) | ||
| 479 | ;; Don't reload a file already loaded. | ||
| 480 | ((and (boundp 'preloaded-file-list) | ||
| 481 | (member load preloaded-file-list))) | ||
| 482 | ((assoc load load-history)) | ||
| 483 | ;; This was just (assoc (locate-library load) load-history) | ||
| 484 | ;; but has been optimized not to load locate-library | ||
| 485 | ;; if not necessary. | ||
| 486 | ((let (found (regexp (regexp-quote load))) | ||
| 487 | (dolist (loaded load-history) | ||
| 488 | (and (string-match regexp (car loaded)) | ||
| 489 | (eq (locate-library load) (car loaded)) | ||
| 490 | (setq found t))) | ||
| 491 | found)) | ||
| 492 | ;; Without this, we would load cus-edit recursively. | ||
| 493 | ;; We are still loading it when we call this, | ||
| 494 | ;; and it is not in load-history yet. | ||
| 495 | ((equal load "cus-edit")) | ||
| 496 | (t | ||
| 497 | (condition-case nil | ||
| 498 | (load-library load) | ||
| 499 | (error nil)))))))) | ||
| 500 | |||
| 460 | ;;; Initializing. | 501 | ;;; Initializing. |
| 461 | 502 | ||
| 462 | (defvar custom-local-buffer nil | 503 | (defvar custom-local-buffer nil |