Advertisement
Guest User

Untitled

a guest
Jan 9th, 2013
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 1.31 KB | None | 0 0
  1. (defun eldocgen-process-files (files)
  2.   "Process each file in FILES in temp buffer. Return the defuns."
  3.   (with-temp-buffer
  4.     (dolist (x files)
  5.       (insert-file-contents x))
  6.     (goto-char (point-min))
  7.     (fetch-defuns (current-buffer))))
  8.  
  9. (defun display-defuns (&optional files)
  10.   "Display the defuns.
  11. Generate docs for FILES (which must be a list of files) if supplied.
  12. If FILES is not supplied, use `buffer-file-name' instead. Ditto
  13. if called interactively.
  14.  
  15. Example:
  16.  
  17. - With a list of files:
  18.   (display-defuns '(\"~/foo.el\" \"~/bar.el\")
  19. - Using `find-lisp-find-files':
  20.   (require 'find-lisp)
  21.   (display-defuns (find-lisp-find-files \"~/.emacs.d\" \"\\\\.el$\"))"
  22.   (interactive)
  23.   (let ((out-buf (if files
  24.                      "*Generated docs*"
  25.                    (format "*Generated docs for: %s*"
  26.                            (file-name-nondirectory buffer-file-name))))
  27.         (files (if files files (list buffer-file-name))))
  28.     (get-buffer-create out-buf)
  29.     (with-current-buffer out-buf
  30.       (erase-buffer)
  31.       ;; TODO: provide filename.
  32.       (insert (eldocgen-process-files files))
  33.       (if (fboundp 'org-mode) (org-mode) (outline-mode))
  34.       (goto-char (point-min))
  35.       (indent-region (point-min) (point-max)))
  36.     (display-buffer out-buf)))
  37.  
  38. (provide 'elisp-documenter)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement