[racket-dev] [racket] getting symbol documentation URL quickly within Emacs
On Saturday, Eli Barzilay wrote:
> [I certainly have a things to say about this, but I'm running out now,
> and will probably have flaky connection throughout the weekend, so I'm
> not sure I'll be able to post something useful until tomorrow.]
[Apologies for the delay.]
There are two main problems that you need to resolve, and the answer
to both of them is the one that you said you won't like (keep a
background racket process).
The first problem is the one you're talking about. You could write
some code that will grab the complete index, then write it out in some
Emacs-friendly way that makes looking up bindings quick. An easier
way to do this is to hook onto the code that does that -- just use the
JS index file, which you can currently find at
"doc/search/plt-index.js" (and you should use this file in the user's
local doc directory, or if it's missing, in the racket directory).
There are comments in the file that should be helpful if you do this,
and you can also look at the code that generates it, which you can
find at "collects/scribblings/main/private/make-search.rkt".
BTW, some "I feel lucky" thing is not going to be a useful feature.
It can work nicely in cases where bindings are relatively unique (for
example, `get-impure-port'), but getting it to do the right thing for
common names (like `cons') will be challenging, since you don't want
someone who works in the r6rs language to keep being frustrated by
getting the wrong docs.
The reason that it's easier to use a racket process should be obvious
-- some of these details might change in the future, and a racket
process will make it much easier to write forward-compatible code.
The time it takes to start the process is not short, but since it's a
background process that shouldn't be a problem.
The second problem makes (IMO, at least) a stronger case for the
racket subprocess solution. How do you know the bindings that are
currently available? If you do this completely in Emacs, you're
inevitably restricting yourself to heuristics that guess stuff based
on `#lang' lines and plain (require ...) sexprs. Consider something
as foreign as r6rs as a good example for how this will break in an
obvious way.
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!