unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Matt Wette <matt.wette@gmail.com>
To: Guile User <guile-user@gnu.org>
Subject: [ANN] scheme-texi minor mode for emacs
Date: Sun, 13 Aug 2023 19:48:58 -0700	[thread overview]
Message-ID: <03938f21-c902-1234-f4f2-161d4c1e4001@gmail.com> (raw)

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	other threads:[~2023-08-14  2:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=03938f21-c902-1234-f4f2-161d4c1e4001@gmail.com \
    --to=matt.wette@gmail.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).