annotate lisp/cus-dep.el @ 17419:c9f73399244c

(elp-functionp): New function. (elp-instrument-package): Don't attempt to instrument autoload functions. (elp-elapsed-time): New function to calculate the different between two `current-time' lists. This no longer throws away the top 16 bits of information. (elp-wrapper): Use elp-elapsed-time instead of elp-get-time. Also, call `current-time' as close to the function entrance and exit as possible so more of the overhead is eliminated from the times. (elp-get-time): Obsolete, deleted. (elp-restore-function): When restoring, do not check assq elp-wrapper if the symbol-function is a compiled lisp function (i.e. byte coded). If it is byte-coded, it could not have been instrumented. Don't do the symbol-function restoration if the symbol has no function definition. (elp-instrument-function): Always `restore' the funsym before instrumenting. Fail if function is an autoload symbol. (elp-instrument-list): Remove unnecessary condition-case. (elp-results): Noninteractive as a function is non-portable, use the variable instead. buffer-substring with 3 arguments is non-portable. (elp-instrument-function, elp-instrument-list): Handle function symbols that have already been instrumented. Do not instrument them twice. (elp-recycle-buffers-p): New variable. (elp-report-limit, elp-sort-by-function): New default values. (elp-use-standard-output): New variable. (elp-results): Optionally dump results to standard-output.
author Richard M. Stallman <rms@gnu.org>
date Sat, 12 Apr 1997 19:14:18 +0000
parents ad9d92edda0d
children 83503d0dc576
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17393
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1 ;;; cus-dep.el --- Find customization dependencies.
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2 ;;
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3 ;; Copyright (C) 1997 Free Software Foundation, Inc.
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4 ;;
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
6 ;; Keywords: internal
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
7
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
8 ;;; Code:
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
9
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
10 (require 'cl)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
11 (load-file "widget.el")
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
12 (load-file "custom.el")
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
13 (load-file "cus-face.el")
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
14
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
15 (defun custom-make-dependencies ()
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
16 "Batch function to extract custom dependencies from .el files.
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
17 Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies"
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
18 (let ((enable-local-eval nil)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
19 (files (directory-files "" nil "\\`[^=].*\\.el\\'" t))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
20 file)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
21 (while files
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
22 (setq file (car files)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
23 files (cdr files))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
24 (message "Checking %s..." file)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
25 (set-buffer (find-file-noselect file))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
26 (goto-char (point-min))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
27 (string-match "\\`\\(.*\\)\\.el\\'" file)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
28 (condition-case nil
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
29 (let ((name (file-name-nondirectory (match-string 1 file))))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
30 (while t
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
31 (let ((expr (read (current-buffer))))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
32 (when (and (listp expr)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
33 (memq (car expr) '(defcustom defface defgroup)))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
34 (eval expr)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
35 (put (nth 1 expr) 'custom-where name)))))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
36 (error nil))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
37 (kill-buffer (current-buffer))))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
38 (message "Generating cus-load.el...")
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
39 (find-file "cus-load.el")
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
40 (erase-buffer)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
41 (insert "\
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
42 ;;; cus-load.el --- automatically extracted custom dependencies
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
43 ;;
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
44 ;;; Code:
17395
ad9d92edda0d Added newline.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17393
diff changeset
45
17393
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
46 ")
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
47 (mapatoms (lambda (symbol)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
48 (let ((members (get symbol 'custom-group))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
49 item where found)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
50 (when members
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
51 (while members
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
52 (setq item (car (car members))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
53 members (cdr members)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
54 where (get item 'custom-where))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
55 (unless (or (null where)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
56 (member where found))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
57 (if found
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
58 (insert " ")
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
59 (insert "(put '" (symbol-name symbol)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
60 " 'custom-loads '("))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
61 (insert (prin1-to-string where))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
62 (push where found)))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
63 (insert "))\n")))))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
64 (insert "\n;;; cus-load.el ends here\n")
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
65 (save-buffer)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
66 (message "Generating cus-load.el..."))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
67
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
68 ;;; cus-dep.el ends here