Lines Matching refs:docstring

1 ;; texi-docstring-magic.el -- munge internal docstrings into texi
8 ;; Id: texi-docstring-magic.el,v 1.2 2004/04/11 17:56:47 karl Exp
25 ;; * The first line of a docstring should be a complete sentence.
38 ;; M-x texi-docstring-magic to update all of the documentation strings.
64 ;; (define-key TeXinfo-mode-map "C-cC-d" 'texi-docstring-magic-insert-magic)
71 ;; * Look for a "texi-docstring" property for symbols
80 (defun texi-docstring-magic-splice-sep (strings sep)
90 (defconst texi-docstring-magic-munge-table
95 ((line (match-string 0 docstring)))
118 (concat "@samp{" (match-string 2 docstring) "}"))
122 (concat "@strong{" (match-string 2 docstring) "}"))
129 (or (boundp (intern (match-string 2 docstring)))
130 (fboundp (intern (match-string 2 docstring))))
131 (concat "@code{" (match-string 2 docstring) "}"
132 (match-string 4 docstring)))
142 (or (> (length (match-string 1 docstring)) 3)
143 (member (downcase (match-string 1 docstring)) args))
144 (concat "@var{" (downcase (match-string 1 docstring)) "}"
145 (match-string 2 docstring)))
151 (concat (match-string 2 docstring)
152 "@code{'" (match-string 3 docstring) "}"
153 (match-string 5 docstring)))
164 and forms such as (match-string 1 docstring)
171 (defun texi-docstring-magic-munge-docstring (docstring args)
174 (dolist (test texi-docstring-magic-munge-table docstring)
182 (< i (length docstring))
183 (string-match regexp docstring i))
189 (setq docstring
190 (replace-match replacement t t docstring))
193 (setq docstring (concat docstring "\n@end lisp"))))))
197 ((pos (string-match "\n" docstring))
200 (substring docstring
204 (concat (substring docstring 0 pos)
206 (substring docstring (1+ pos)))
207 docstring)))
209 (defun texi-docstring-magic-texi (env grp name docstring args &optional endtext)
213 (texi-docstring-magic-splice-sep args " ")
215 ;; (texi-docstring-magic-splice-sep extras " ")
217 (texi-docstring-magic-munge-docstring docstring args)
222 (defun texi-docstring-magic-format-default (default)
236 (defun texi-docstring-magic-texi-for (symbol)
243 (docstring (or (face-doc-string face)
245 (useropt (eq ?* (string-to-char docstring))))
248 (setq docstring (substring docstring 1)))
249 (texi-docstring-magic-texi "fn" "Face" name docstring nil)))
256 (docstring (or (documentation function)
263 (texi-docstring-magic-texi "fn" "Command" name docstring args)
264 (texi-docstring-magic-texi "un" nil name docstring args))))
270 (docstring (or (documentation-property variable
273 (useropt (eq ?* (string-to-char docstring)))
275 (texi-docstring-magic-format-default
279 (setq docstring (substring docstring 1)))
280 (texi-docstring-magic-texi
281 (if useropt "opt" "var") nil name docstring nil default)))
285 (defconst texi-docstring-magic-comment
289 (defun texi-docstring-magic ()
290 "Update all texi docstring magic annotations in buffer."
295 (regexp-quote texi-docstring-magic-comment)
311 (texi-docstring-magic-texi-for symbol))))))
313 (defun texi-docstring-magic-face-at-point ()
328 (defun texi-docstring-magic-insert-magic (symbol)
332 (texi-docstring-magic-face-at-point)))
336 (format "Magic docstring for symbol (default %s): " v)
337 "Magic docstring for symbol: ")
344 (insert "\n" texi-docstring-magic-comment " " (symbol-name symbol)))
347 (provide 'texi-docstring-magic)