guile-user
[Top][All Lists]
Advanced

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

Re: my emacs minor-mode for generating docstrings, v180902d


From: Matt Wette
Subject: Re: my emacs minor-mode for generating docstrings, v180902d
Date: Mon, 3 Sep 2018 05:49:29 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 09/02/2018 04:30 PM, Arne Babenhauserheide wrote:
Matt Wette <address@hidden> writes:

Now if I load my scheme-texidoc minor mode, place the point just before
`(define (' and hit [(control c) (control d)], I end up with a docstring
generated by running the comments through `texi2any --plaintext'.

;; @deffn {Procedure} prece a b po
;; Return precedence for arguments @var{a}, @var{b} given the partial
;; order @var{po}.  The result is of the form @code{'lt}, @code{'gt},
;; @code{'eq} or @address@hidden
;; Note: @var{po} may not a true partial order as we can have a<b and
;; b<a => a=b.  For example,
;; @example
;; @code{(prece a a po)} => @code{'eq}.
;; @end example
;; @end deffn
(define (prece a b po)
   "- Procedure: prece a b po
      Return precedence for arguments A, B given the partial order PO.
      The result is of the form ''lt', ''gt', ''eq' or '#f'.
      Note: PO may not a true partial order as we can have a<b and b<a =>
      a=b.  For example,
           (prece a a po) => 'eq."
   (cond
    ((eqv? a b) 'eq)
    ((eqv? a '$error) 'lt)
    ((eqv? b '$error) 'gt)
    ((<? a b po) (if (<? b a po) 'eq 'lt))
    (else (if (<? b a po) 'gt #f))))


and in Guile I get

scheme@(guile-user)> ,d prece
- Procedure: prece a b po
      Return precedence for arguments A, B given the partial order PO.
      The result is of the form ''lt', ''gt', ''eq' or '#f'.
      Note: PO may not a true partial order as we can have a<b and b<a =>
      a=b.  For example,
           (prece a a po) => 'eq.
This looks pretty useful. I don’t write texinfo yet (though I should),
but if I did, getting rid of the repetition is great!

Thanks.  I was after formatted docstrings.  I still need to add:
1) robust way to find insert point for docstring
2) ability to remove old docstring if present

The elisp code has been added to my repo at 
https://github.com/mwette/guile-contrib.

Matt

or




reply via email to

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