]> code.delx.au - gnu-emacs-elpa/blob - lispdoc.el
Bug fixes and the beginnings of ICS client support
[gnu-emacs-elpa] / lispdoc.el
1 (defun update-lispdoc-tags ()
2 (interactive)
3 (save-excursion
4 (goto-char (point-min))
5 (while (re-search-forward "^@c lispfun \\(.+\\)" nil t)
6 (let ((name (match-string 1)) begin end)
7 (message "Update lispdoc for function '%s'" name)
8 (if (re-search-forward (concat "^@defun " name) nil t)
9 (setq begin (match-beginning 0)))
10 (if (re-search-forward "^@end defun" nil t)
11 (setq end (match-end 0)))
12 (if (and begin end)
13 (delete-region begin end))
14 (let* ((sym (or (intern-soft name)
15 (error "'%s' is not a function!" name)))
16 (data (symbol-function sym))
17 (args (pp-to-string (if (listp data)
18 (cadr data)
19 (aref data 0))))
20 (doc (documentation sym)))
21 (if (or (null doc) (= (length doc) 0))
22 (message "warning: no documentation available for '%s'" name)
23 (unless (and begin end)
24 (insert ?\n ?\n))
25 (insert (format "@defun %s %s\n" name
26 (substring args 1 (- (length args) 2))))
27 (setq begin (point))
28 (insert doc ?\n)
29 (save-restriction
30 (narrow-to-region begin (point))
31 (goto-char (point-min))
32 (let ((case-fold-search nil))
33 (while (re-search-forward "[A-Z][A-Z-]+" nil t)
34 (replace-match (format "@var{%s}"
35 (downcase (match-string 0))) t t)))
36 (goto-char (point-max)))
37 (insert "@end defun")))))))
38
39 (defun chess-undocd-functions ()
40 (interactive)
41 (save-excursion
42 (dolist (func (apropos-internal "^chess-" 'functionp))
43 (goto-char (point-min))
44 (unless (search-forward (concat "@c lispfun " (symbol-name func)) nil t)
45 (message "Missing documentation for '%s'" (symbol-name func))))))
46
47 (provide 'lispdoc)