Mercurial > emacs
changeset 47824:f9a9cf859646
(custom-make-dependencies): Don't use find-file.
Use feature names rather than file names if applicable.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Thu, 10 Oct 2002 13:33:57 +0000 |
parents | 4649d9cb92dd |
children | 3c21e01f4d87 |
files | lisp/cus-dep.el |
diffstat | 1 files changed, 17 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/cus-dep.el Thu Oct 10 13:10:53 2002 +0000 +++ b/lisp/cus-dep.el Thu Oct 10 13:33:57 2002 +0000 @@ -34,30 +34,29 @@ (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)) is-autoloaded) - (cd (car all-subdirs)) - (while files - (setq file (car files) - files (cdr files)) + (dolist (file files) (when (file-exists-p 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 @@ -71,10 +70,9 @@ (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