0
|
1 (defun member (e list)
|
|
2 (while (and list (not (equal e (car list))))
|
|
3 (setq list (cdr list)))
|
|
4 list )
|
|
5
|
|
6 (defun print-autoloads ()
|
|
7 (let ((files (cdr (member "print-autoloads" command-line-args)))
|
|
8 ;; kludge for broken v19 emacs. it's supposed to accept
|
|
9 ;; t in autoloads to mean 'macro but it doesn't. this
|
|
10 ;; kludge will screw people who try to byte-compile VM
|
|
11 ;; with emacs18 for emacs19.
|
|
12 (macro-flag (if (string-match "^19" emacs-version) ''macro t))
|
|
13 sexp function doc interactive macro)
|
|
14 (setq expanded-files (mapcar (function expand-file-name) files))
|
|
15 (while files
|
|
16 (set-buffer (find-file-noselect (car expanded-files)))
|
|
17 (goto-char (point-min))
|
|
18 (condition-case nil
|
|
19 (while t
|
|
20 (setq sexp (read (current-buffer)))
|
|
21 (if (and (consp sexp) (cdr sexp)
|
|
22 (or (eq (car sexp) 'defun)
|
|
23 (eq (car sexp) 'defmacro)))
|
|
24 (progn
|
|
25 (if (eq (car sexp) 'defmacro)
|
|
26 (setq macro macro-flag)
|
|
27 (setq macro nil))
|
|
28 (setq sexp (cdr sexp)
|
|
29 function (car sexp)
|
|
30 sexp (cdr (cdr sexp)))
|
|
31 (if (stringp (car sexp))
|
|
32 (setq doc (car sexp)
|
|
33 sexp (cdr sexp))
|
|
34 (setq doc nil))
|
|
35 (if (and (consp (car sexp))
|
|
36 (eq (car (car sexp)) 'interactive))
|
|
37 (setq interactive t)
|
|
38 (setq interactive nil))
|
|
39 (if (string-match "\\.el$" (car files))
|
|
40 (setq file (substring (car files) 0 -3))
|
|
41 (setq file (car files)))
|
|
42 (print (list 'autoload (list 'quote function) file
|
|
43 doc interactive macro)))))
|
|
44 (end-of-file nil))
|
|
45 (kill-buffer (current-buffer))
|
|
46 (setq files (cdr files)
|
|
47 expanded-files (cdr expanded-files))))
|
|
48 (kill-emacs))
|