--- cus-dep.el-20020919 2002-09-19 18:57:48 +0000 +++ cus-dep.el-current 2002-11-07 01:05:06 +0000 @@ -34,30 +34,38 @@ (defun custom-make-dependencies () "Batch function to extract custom dependencies from .el files. Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies DIRS" - (let ((enable-local-eval nil) - (all-subdirs command-line-args-left) - (start-directory default-directory)) - (get-buffer-create " cus-dep temp") - (set-buffer " cus-dep temp") - (while all-subdirs - (message "Directory %s" (car all-subdirs)) - (let ((files (directory-files (car all-subdirs) nil "\\`[^=].*\\.el\\'")) - (default-directory default-directory) - file + (let ((enable-local-eval nil)) + (set-buffer (get-buffer-create " cus-dep temp")) + (dolist (subdir command-line-args-left) + (message "Directory %s" subdir) + (let ((files (directory-files subdir nil "\\`[^=].*\\.el\\'")) + (default-directory (expand-file-name subdir)) + (preloaded (concat "\\`" + (regexp-opt (mapcar + (lambda (f) + (file-name-sans-extension + (file-name-nondirectory f))) + preloaded-file-list) t) + "\\.el\\'")) is-autoloaded) - (cd (car all-subdirs)) - (while files - (setq file (car files) - files (cdr files)) - (when (file-exists-p file) + (dolist (file files) + (when (and (file-exists-p file) + ;; Ignore files that are preloaded. + (not (string-match preloaded file))) (erase-buffer) (insert-file-contents file) (goto-char (point-min)) (string-match "\\`\\(.*\\)\\.el\\'" file) (let ((name (file-name-nondirectory (match-string 1 file)))) + (if (save-excursion + (re-search-forward + (concat "(provide[ \t\n]+\\('\\|(quote[ \t\n]\\)[ \t\n]*" + (regexp-quote name) "[ \t\n)]") + nil t)) + (setq name (intern name))) (condition-case nil - (while (re-search-forward "^(defcustom\\|^(defface\\|^(defgroup" - nil t) + (while (re-search-forward + "^(def\\(custom\\|face\\|group\\)" nil t) (setq is-autoloaded nil) (beginning-of-line) (save-excursion @@ -66,15 +74,14 @@ (setq is-autoloaded t))) (let ((expr (read (current-buffer)))) (condition-case nil - (progn + (let ((custom-dont-initialize t)) (eval expr) (put (nth 1 expr) 'custom-autoloaded is-autoloaded) (put (nth 1 expr) 'custom-where name)) (error nil)))) - (error nil))))) - (setq all-subdirs (cdr all-subdirs))))) + (error nil)))))))) (message "Generating cus-load.el...") - (find-file "cus-load.el") + (set-buffer (find-file-noselect "cus-load.el")) (erase-buffer) (insert "\ ;;; cus-load.el --- automatically extracted custom dependencies @@ -89,15 +96,7 @@ ;; So x and no-x builds won't differ. (setq members (sort (copy-sequence members) - (lambda (x y) - (cond ((and (stringp x) (stringp y)) - (string< x y)) - ;; Put all non-strings before strings. - ((stringp y) t) - ((stringp x) nil) - ;; For two non-strings, - ;; use the order they appear in MEMBERS. - (t (member y (member x members))))))) + (lambda (x y) (string< (car x) (car y))))) (while members (setq item (car (car members)) members (cdr members) @@ -114,7 +113,7 @@ (insert "))\n")))))) (insert "\ ;;; These are for handling :version. We need to have a minimum of -;;; information so `custom-changed-variables' could do its job. +;;; information so `customize-changed-options' could do its job. ;;; For both groups and variables we have to set `custom-version'. ;;; For variables we also set the `standard-value' and for groups ;;; `group-documentation' (which is shown in the customize buffer), so