175 |
(defun help-add-fundoc-usage (doc arglist) |
(defun help-add-fundoc-usage (doc arglist) |
176 |
"Add the usage info to the docstring DOC. |
"Add the usage info to the docstring DOC. |
177 |
If DOC already has a usage info, then just return DOC unchanged. |
If DOC already has a usage info, then just return DOC unchanged. |
178 |
The usage info is built from ARGLIST. DOC can be nil." |
The usage info is built from ARGLIST. DOC can be nil. |
179 |
|
ARGLIST can also be t or a string of the form \"(fun ARG1 ARG2 ...)\"." |
180 |
(unless (stringp doc) (setq doc "Not documented")) |
(unless (stringp doc) (setq doc "Not documented")) |
181 |
(if (string-match "\n\n(fn\\(\\( .*\\)?)\\)\\'" doc) |
(if (or (string-match "\n\n(fn\\(\\( .*\\)?)\\)\\'" doc) (eq arglist t)) |
182 |
doc |
doc |
183 |
(format "%s%s%s" doc |
(format "%s%s%s" doc |
184 |
(if (string-match "\n?\n\\'" doc) |
(if (string-match "\n?\n\\'" doc) |
185 |
(if (< (- (match-end 0) (match-beginning 0)) 2) "\n") |
(if (< (- (match-end 0) (match-beginning 0)) 2) "\n" "") |
186 |
"\n\n") |
"\n\n") |
187 |
(help-make-usage 'fn arglist)))) |
(if (and (stringp arglist) |
188 |
|
(string-match "\\`([^ ]+\\(.*\\))\\'" arglist)) |
189 |
|
(concat "(fn" (match-string 1 arglist) ")") |
190 |
|
(help-make-usage 'fn arglist))))) |
191 |
|
|
192 |
(defun help-function-arglist (def) |
(defun help-function-arglist (def) |
193 |
;; Handle symbols aliased to other symbols. |
;; Handle symbols aliased to other symbols. |
413 |
(delete-region (1- from) from))))) |
(delete-region (1- from) from))))) |
414 |
(terpri) |
(terpri) |
415 |
(when (local-variable-p variable) |
(when (local-variable-p variable) |
416 |
(princ (format "Local in buffer %s; " (buffer-name))) |
(princ (format "%socal in buffer %s; " |
417 |
|
(if (get variable 'permanent-local) |
418 |
|
"Permanently l" "L") |
419 |
|
(buffer-name))) |
420 |
(if (not (default-boundp variable)) |
(if (not (default-boundp variable)) |
421 |
(princ "globally void") |
(princ "globally void") |
422 |
(let ((val (default-value variable))) |
(let ((val (default-value variable))) |
569 |
|
|
570 |
(provide 'help-fns) |
(provide 'help-fns) |
571 |
|
|
572 |
|
;;; arch-tag: 9e10331c-ae81-4d13-965d-c4819aaab0b3 |
573 |
;;; help-fns.el ends here |
;;; help-fns.el ends here |