On 09/02/2018 04:30 PM, Arne Babenhauserheide wrote:
Matt Wette <matt.we...@gmail.com> 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 @code{#f}.@*
;; 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