Re: completion on guile-gnome symbols

Andy Wingo <[email protected]> Thu, 24 Jul 2008 12:46:29 +0200
Newsgroups gmane.lisp.guile.gtk
Message-ID <[email protected]>
Hi,

On Mon 21 Jul 2008 14:27, "Neil Jerram" <[email protected]> writes:

> 2008/7/18 Andre Kuehne <[email protected]>:
>>
>> is there a way to get completion on all guile-gnome-* symbols?
>
> +1.  I've had exactly this problem in the past too.

Sorry for the late reply. I agree this is the suck.

Late-bound variables are stored in a hash, %gw-latent-variables-hash.
The classes are stored in the g-wrap modules corresponding to the
wrapsets, and the generics are stored in (gnome gw generics) -- there
are some docs about this general strategy in guile-gnome-glib's docs.

To force creation of all of those variables, just reference them in the
modules. So for example to programmatically force creation of all
symbols in some modules, try this:

(define (force-bindings . modules)
  (for-each
   (lambda (sym)
     (let ((mod (resolve-module `(gnome gw ,sym))))
       (for-each
        (lambda (k)
          (module-ref (module-public-interface mod) k))
        ;; copy list of syms because the module binder mutates the hash
        (hash-map->list
         (lambda (k v) k)
         (module-ref mod '%gw-latent-variables-hash)))))
   modules))

;; use like this
(force-bindings 'generics 'gtk)

But obviously that's not the best solution. Do you have a better
suggestion? I'd be happy to include something like that in Guile-GNOME.

Cheers,

Andy
-- 
http://wingolog.org/