Mercurial > emacs
changeset 47822:46f8bf0fc7b4
(custom-group-of-mode): New fun.
(custom-load-symbol): Don't use preloaded-file-list now that
load-history is always complete. Don't look up the expanded file
name in load-history (looked like an XEmacsism).
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Thu, 10 Oct 2002 13:09:13 +0000 |
parents | 45dcf3407814 |
children | 4649d9cb92dd |
files | lisp/custom.el |
diffstat | 1 files changed, 20 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/custom.el Thu Oct 10 13:01:14 2002 +0000 +++ b/lisp/custom.el Thu Oct 10 13:09:13 2002 +0000 @@ -231,7 +231,7 @@ in customization menus and buffers. :load FILE Load file FILE (a string) before displaying this customization - item. Loading is done with `load-library', and only if the file is + item. Loading is done with `load', and only if the file is not already loaded. :set-after VARIABLE Specifies that SYMBOL should be set after VARIABLE when @@ -379,6 +379,17 @@ (unless (member entry members) (put group 'custom-group (nconc members (list entry)))))) +(defun custom-group-of-mode (mode) + "Return the custom group corresponding to the major or minor MODE. +If no such group is found, return nil." + (or (get mode 'custom-mode-group) + (if (or (get mode 'custom-group) + (and (string-match "-mode\\'" (symbol-name mode)) + (get (setq mode (intern (substring (symbol-name mode) + 0 (match-beginning 0)))) + 'custom-group))) + mode))) + ;;; Properties. (defun custom-handle-all-keywords (symbol args type) @@ -472,38 +483,27 @@ (defun custom-load-symbol (symbol) "Load all dependencies for SYMBOL." (unless custom-load-recursion - (let ((custom-load-recursion t) - (loads (get symbol 'custom-loads)) - load) - (while loads - (setq load (car loads) - loads (cdr loads)) - (cond ((symbolp load) - (condition-case nil - (require load) - (error nil))) - ;; Don't reload a file already loaded. - ((and (boundp 'preloaded-file-list) - (member load preloaded-file-list))) + (let ((custom-load-recursion t)) + (dolist (load (get symbol 'custom-loads)) + (cond ((symbolp load) (condition-case nil (require load) (error nil))) + ;; This is subsumed by the test below, but it's much faster. ((assoc load load-history)) ;; This was just (assoc (locate-library load) load-history) ;; but has been optimized not to load locate-library ;; if not necessary. - ((let (found (regexp (regexp-quote load))) + ((let ((regexp (concat "\\(\\`\\|/\\)" (regexp-quote load) + "\\(\\'\\|\\.\\)")) + (found nil)) (dolist (loaded load-history) (and (stringp (car loaded)) (string-match regexp (car loaded)) - (eq (locate-library load) (car loaded)) (setq found t))) found)) ;; Without this, we would load cus-edit recursively. ;; We are still loading it when we call this, ;; and it is not in load-history yet. ((equal load "cus-edit")) - (t - (condition-case nil - (load-library load) - (error nil)))))))) + (t (condition-case nil (load load) (error nil)))))))) ;;; Initializing.