On Mon, Apr 6, 2015 at 6:53 PM, David Nalesnik <david.nales...@gmail.com>
wrote:

> Hi list,
>
> Here's something which I think will be useful to Schemers.
>
> Public functions written in Scheme aren't documented (except in the
> source).  (The list of "Scheme functions" in the Internals Reference
> consists of functions defined in C++ which are available in Scheme.)  The
> attached will produce a list of all such functions, giving useful
> information including a documentation string where provided.  Markup
> functions (which are documented elsewhere in their Lily syntax -- i.e.,
> \rest for rest-markup -- can be omitted.)  You can also list the contents
> of other modules.
>
>
A little more concise...
\version "2.19.17"

#(define (get-binding-list iface)
   (ly:module->alist (resolve-module iface)))

#(define (symbol-closure-list iface)
   (let* ((bindings (get-binding-list iface))
          (closures
           (filter
            (lambda (b) (closure? (cdr b)))
            bindings))
          (closures
           (sort closures
             (lambda (x y) (symbol<? (car x) (car y))))))
     closures))

#(define (omit-markup-functions lst)
   (remove
    (lambda (elt)
      (string-contains (symbol->string (car elt)) "markup"))
    lst))

#(define (symbol-closure-doc-list iface omit-markups?)
   (let* ((closures (symbol-closure-list iface))
          (closures (if omit-markups?
                        (omit-markup-functions closures)
                        closures)))
     (map (lambda (c)
            (list
             (car c)
             (cdr c)
             (or (procedure-documentation (cdr c))
                 "DOCME")))
       closures)))

% UNCOMMENT THE FOLLOWING TO SEND TO A FILE:

%#(set-current-output-port (open-output-file "closures.txt"))

%% boolean determines whether markup commands (which are documented
%% in their Lily syntax) are included.

#(format #t "~:{~a~%~a~%~3t~s~%__________~%~%~}" (symbol-closure-doc-list '(lily) #t))

%#(format #t "~:{~a~%~a~%~3t~s~%__________~%~%~}" (symbol-closure-doc-list '(srfi srfi-1) #f))
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to