;;; cus-dep.el --- Find customization dependencies.;;;; Copyright (C) 1997 Free Software Foundation, Inc.;;;; Author: Per Abrahamsen <abraham@dina.kvl.dk>;; Keywords: internal;; This file is part of GNU Emacs.;; GNU Emacs is free software; you can redistribute it and/or modify;; it under the terms of the GNU General Public License as published by;; the Free Software Foundation; either version 2, or (at your option);; any later version.;; GNU Emacs is distributed in the hope that it will be useful,;; but WITHOUT ANY WARRANTY; without even the implied warranty of;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the;; GNU General Public License for more details.;; You should have received a copy of the GNU General Public License;; along with GNU Emacs; see the file COPYING. If not, write to the;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,;; Boston, MA 02111-1307, USA.;;; Code:(require'cl)(require'widget)(require'cus-face)(defuncustom-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-evalnil)(all-subdirscommand-line-args-left)(start-directorydefault-directory))(get-buffer-create" cus-dep temp")(set-buffer" cus-dep temp")(whileall-subdirs(message"Directory %s"(carall-subdirs))(let((files(directory-files(carall-subdirs)nil"\\`[^=].*\\.el\\'"))(default-directorydefault-directory)file)(cd(carall-subdirs))(whilefiles(setqfile(carfiles)files(cdrfiles))(when(file-exists-pfile)(message"Checking %s..."file)(erase-buffer)(insert-file-contentsfile)(goto-char(point-min))(string-match"\\`\\(.*\\)\\.el\\'"file)(let((name(file-name-nondirectory(match-string1file))))(condition-casenil(while(re-search-forward"^(defcustom\\|^(defface\\|^(defgroup"nilt)(beginning-of-line)(let((expr(read(current-buffer))))(evalexpr)(put(nth1expr)'custom-wherename)))(errornil)))))(setqall-subdirs(cdrall-subdirs)))))(message"Generating cus-load.el...")(find-file"cus-load.el")(erase-buffer)(insert"\;;; cus-load.el --- automatically extracted custom dependencies;;;;; Code:")(mapatoms(lambda(symbol)(let((members(getsymbol'custom-group))itemwherefound)(whenmembers(whilemembers(setqitem(car(carmembers))members(cdrmembers)where(getitem'custom-where))(unless(or(nullwhere)(memberwherefound))(iffound(insert" ")(insert"(put '"(symbol-namesymbol)" 'custom-loads '("))(prin1where(current-buffer))(pushwherefound)))(whenfound(insert"))\n"))))))(insert"\\(provide 'cus-load);;; cus-load.el ends here\n")(let((kept-new-versions10000000))(save-buffer))(message"Generating cus-load.el...done")(kill-emacs));;; cus-dep.el ends here