blob: bbeb778eee506fe9e01c1bbc8638e4946d307d1f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
(require 'pp)
(defun update-lispdoc-tags ()
(interactive)
(save-excursion
(goto-char (point-min))
(while (re-search-forward "^@c lispfun \\(.+\\)" nil t)
(let ((name (match-string 1)) begin end)
(message "Update lispdoc for function '%s'" name)
(if (re-search-forward (concat "^@defun " name) nil t)
(setq begin (match-beginning 0)))
(if (re-search-forward "^@end defun" nil t)
(setq end (match-end 0)))
(if (and begin end)
(delete-region begin end))
(let* ((sym (or (intern-soft name)
(signal 'wrong-type-argument
(list 'functionp name))))
(data (let ((func (symbol-function sym)))
(while (symbolp func)
(setq func (symbol-function func)))
func))
(args (pp-to-string (if (listp data)
(cadr data)
(aref data 0))))
(doc (documentation sym)))
(if (or (null doc) (= (length doc) 0))
(message "warning: no documentation available for '%s'" name)
(unless (and begin end)
(insert ?\n ?\n))
(insert (format "@defun %s %s\n" name
(substring args 1 (- (length args) 2))))
(setq begin (point))
(insert doc ?\n)
(save-restriction
(narrow-to-region begin (point))
(goto-char (point-min))
(let ((case-fold-search nil))
(while (re-search-forward "[A-Z][A-Z-]+" nil t)
(replace-match (format "@var{%s}"
(downcase (match-string 0))) t t)))
(goto-char (point-max)))
(insert "@end defun")))))))
(defun chess-undocd-functions ()
(interactive)
(save-excursion
(dolist (func (apropos-internal "^chess-" 'functionp))
(goto-char (point-min))
(unless (search-forward (concat "@c lispfun " (symbol-name func)) nil t)
(message "Missing documentation for '%s'" (symbol-name func))))))
(provide 'lispdoc)
|