```unofficial mirror of guile-user@gnu.org
help / color / mirror / Atom feed```
```* [ANN] scheme-texi minor mode for emacs
@ 2023-08-14  2:48 Matt Wette
0 siblings, 0 replies; only message in thread
From: Matt Wette @ 2023-08-14  2:48 UTC (permalink / raw)
To: Guile User

Hi All,

I have created a minor mode for emacs that generates docstrings for
procedures from comments provided in the code.   I announced this a few
years ago, but the version released then was not
very robust.   I have reworked this and it is more robust.   (It
probably needs graceful failure still.)

The code is available in my guile-contrib repo on github:
https://github.com/mwette/guile-contrib

The path to the file is here:
https://github.com/mwette/guile-contrib/blob/main/scheme-texidoc.el

What the file does is turn this:

;; @deffn {Scheme} foo a b c
;; This function is pretty silly.  Given @var{a}, @var{b} @var{c}
;; return the sum plus 3.
;; @example
;; > (foo 4 5 6)
;; \$1 = 18
;; @end example
;; @end deffn
(define (foo a b c)
(let ((x 1)
(y 2))
(+ x y a b c)))

into ;; @deffn {Scheme} foo a b c
;; This function is pretty silly.  Given @var{a}, @var{b} @var{c}
;; return the sum plus 3.
;; @example
;; > (foo 4 5 6)
;; \$1 = 18
;; @end example
;; @end deffn
(define (foo a b c)
"- Scheme: foo a b c
This function is pretty silly.  Given A, B C return the sum plus 3.
> (foo 4 5 6)
\$1 = 18"
(let ((x 1)
(y 2))
(+ x y a b c)))

All it takes is to have point in the body of the code or the comments,
and then hit Cx-td.
If there is already an old docstring, it will replace it.

Similarly

;; @deffn {Scheme} bar a b c
;; This function is pretty silly.  Given @var{a}, @var{b} @var{c}
;; return the sum plus 3.
;; @example
;; > (bar 4 5 6)
;; \$1 = 18
;; @end example
;; @end deffn
(define bar
(lambda (a b c)
(let ((x 1)
(y 2))
(+ x y a b c))))

;; @deffn {Scheme} baz a b c
;; This function is pretty silly.  Given @var{a}, @var{b} @var{c}
;; return the sum plus 3.
;; @example
;; > (baz 4 5 6)
;; \$1 = 18
;; @end example
;; @end deffn
(define foo
(let ((x 1) (y 2))
(lambda (a b c)
(+ x y a b c))))

turns into

;; @deffn {Scheme} bar a b c
;; This function is pretty silly.  Given @var{a}, @var{b} @var{c}
;; return the sum plus 3.
;; @example
;; > (bar 4 5 6)
;; \$1 = 18
;; @end example
;; @end deffn
(define bar
(lambda (a b c)
"- Scheme: bar a b c
This function is pretty silly.  Given A, B C return the sum plus 3.
> (bar 4 5 6)
\$1 = 18"
(let ((x 1)
(y 2))
(+ x y a b c))))

;; @deffn {Scheme} baz a b c
;; This function is pretty silly.  Given @var{a}, @var{b} @var{c}
;; return the sum plus 3.
;; @example
;; > (baz 4 5 6)
;; \$1 = 18
;; @end example
;; @end deffn
(define foo
(let ((x 1) (y 2))
(lambda (a b c)
"- Scheme: baz a b c
This function is pretty silly.  Given A, B C return the sum plus 3.
> (baz 4 5 6)
\$1 = 18"
(+ x y a b c))))
`

Matt

```only message in thread, other threads:[~2023-08-14  2:48 UTC | newest]
```This is a public inbox, see mirroring instructions