From: "Jose A. Ortega Ruiz" <jao@gnu.org>
To: Andy Wingo <wingo@igalia.com>
Cc: guix-devel@gnu.org, geiser-users@nongnu.org
Subject: Re: [Geiser-users] geiser-xref-callers does not seem to work
Date: Tue, 30 Jan 2018 23:55:15 +0100 [thread overview]
Message-ID: <87lggf9cto.fsf@imladris> (raw)
In-Reply-To: <87tvv34vjy.fsf@igalia.com> (Andy Wingo's message of "Tue, 30 Jan 2018 09:09:37 +0100")
On Tue, Jan 30 2018, Andy Wingo wrote:
> On Mon 29 Jan 2018 18:52, "Jose A. Ortega Ruiz" <jao@gnu.org> writes:
>
>> i've figured out how to find the filename for a procedure, but i'm
>> missing what is probably the easier part: give the latter, how do i get
>> hold of the module object?
>
> On the one side there's no 100% reliable way. E.g. some files don't
> declare what module they're in, and so if they are loaded (e.g. via
> "include") from within some other module, then they inherit the current
> module from the caller.
>
> However there is the very common case in which each file defines a
> module -- there, I would actually go about this in the other way. Walk
> the module tree and record source file names that map to modules.
> However like source-procedures, probably Guile should bake this facility
> into (system xref). Anyway here is a procedure that will do it:
>
> ;; Return hash table mapping filename to list of modules defined in that
> ;; file.
> (define (compute-source->module-mapping)
> (let ((ret (make-hash-table)))
> (define (record-module m)
> (let ((f (module-filename m)))
> (hash-set! ret f (cons m (hash-ref ret f '())))))
> (define (visit-module m)
> (record-module m)
> (hash-for-each (lambda (k v) (visit-module v))
> (module-submodules m)))
> (visit-module (resolve-module '() #f))
> ret))
Thanks, this is working for me! And replacing program-arities was
trivial given the new debug utilities.
Chris, as a result, xref is working for me too in the latest geiser in
git: please give it a try when you can, and thanks for your patience :)
Cheers,
jao
--
Patriotism is a kind of religion; it is the egg from which wars are
hatched. -Guy de Maupassant, short story writer and novelist (1850-1893)
prev parent reply other threads:[~2018-01-30 22:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-16 7:55 geiser-xref-callers does not seem to work Chris Marusich
2017-12-16 8:38 ` Chris Marusich
[not found] ` <87y3m3hxts.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-12-16 18:45 ` Jose A. Ortega Ruiz
2017-12-18 9:34 ` Andy Wingo
2017-12-19 7:47 ` Chris Marusich
[not found] ` <87shc8qt0p.fsf-wEGTBA9jqPzQT0dZR+AlfA@public.gmane.org>
2018-01-27 16:41 ` Jose A. Ortega Ruiz
2018-01-29 8:53 ` Andy Wingo
[not found] ` <87mv0x59n3.fsf-wEGTBA9jqPzQT0dZR+AlfA@public.gmane.org>
2018-01-29 17:52 ` Jose A. Ortega Ruiz
2018-01-30 8:09 ` Andy Wingo
2018-01-30 22:55 ` Jose A. Ortega Ruiz [this message]
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://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lggf9cto.fsf@imladris \
--to=jao@gnu.org \
--cc=geiser-users@nongnu.org \
--cc=guix-devel@gnu.org \
--cc=wingo@igalia.com \
/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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
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).