summaryrefslogtreecommitdiff
path: root/lispdoc.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2002-04-08 03:37:26 +0000
committerJohn Wiegley <johnw@newartisans.com>2002-04-08 03:37:26 +0000
commitb60fd83dd950c2c5ef04f23f25bf0d25ac9c11db (patch)
treefb1c6e3aced45c08bcd1a3ee173a1c21afeff704 /lispdoc.el
parent48b77c46e15e664ffeab0c612418f4505c48f7b8 (diff)
Simplified the code, removed the 'search-function' nonsense. Even the
wackiest chess variants use standard move notation. `chess-ply-create' now fully validates and annotates the plies that it creates, based on the initial piece move (such as the king, in the case of castling).
Diffstat (limited to 'lispdoc.el')
-rw-r--r--lispdoc.el47
1 files changed, 47 insertions, 0 deletions
diff --git a/lispdoc.el b/lispdoc.el
new file mode 100644
index 0000000..88994b2
--- /dev/null
+++ b/lispdoc.el
@@ -0,0 +1,47 @@
+(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)
+ (error "'%s' is not a function!" name)))
+ (data (symbol-function sym))
+ (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)