vm / make-autoloads

(defun member (e list)
  (while (and list (not (equal e (car list))))
    (setq list (cdr list)))
  list )

(defun print-autoloads ()
  (let ((files (cdr (member "print-autoloads" command-line-args)))
	;; kludge for broken v19 emacs.  It's supposed to accept
	;; t in autoloads to mean 'macro but it doesn't.  this
	;; kludge will screw people who try to byte-compile VM
	;; with emacs18 for emacs19.
	(macro-flag (if (string-match "^19" emacs-version) ''macro t))
	sexp function doc interactive macro)
    (setq expanded-files (mapcar (function expand-file-name) files))
    (while files
      (set-buffer (find-file-noselect (car expanded-files)))
      (goto-char (point-min))
      (condition-case nil
	  (while t
	    (setq sexp (read (current-buffer)))
	    (if (and (consp sexp) (cdr sexp)
		     (memq (car sexp) '(defun defmacro defsubst)))
		  (if (memq (car sexp) '(defmacro defsubst))
		      (setq macro macro-flag)
		    (setq macro nil))
		  (setq sexp (cdr sexp)
			function (car sexp)
			sexp (cdr (cdr sexp)))
		  (if (stringp (car sexp))
		      (setq doc (car sexp)
			    sexp (cdr sexp))
		    (setq doc nil))
		  (if (and (consp (car sexp))
			   (eq (car (car sexp)) 'interactive))
		      (setq interactive t)
		    (setq interactive nil))
		  (if (string-match "\\.el$" (car files))
		      (setq file (substring (car files) 0 -3))
		    (setq file (car files)))
		  (print (list 'autoload (list 'quote function) file
			       doc interactive macro)))))
	(end-of-file nil))
      (kill-buffer (current-buffer))
      (setq files (cdr files)
	    expanded-files (cdr expanded-files))))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.