guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ANN] scheme-texi minor mode for emacs


From: Matt Wette
Subject: [ANN] scheme-texi minor mode for emacs
Date: Sun, 13 Aug 2023 19:48:58 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]