Regarding collections ...

55 views
Skip to first unread message

Don Green

unread,
Jun 3, 2021, 11:26:59 PM6/3/21
to Racket Users
Using DrRacket in linux:
When I run DrRacket from a terminal,

(current-library-collection-paths) returns the expected paths, 3 of them.

However, when I open one of my .ss files which is associated with drracket,

the file opens in drracket but (current-library-collection-paths) returns only 2 of the 3 desired collection paths.

Should I use info.rkt to specify the 3 desired collection paths?

Matthew Flatt

unread,
Jun 4, 2021, 9:21:17 AM6/4/21
to Don Green, Racket Users
At Thu, 3 Jun 2021 20:26:59 -0700 (PDT), Don Green wrote:
> Using DrRacket in linux:
> When I run DrRacket from a terminal,
>
> (current-library-collection-paths) returns the expected paths, 3 of them.
>
> However, when I open one of my .ss files which is associated with drracket,
>
> the file opens in drracket but (current-library-collection-paths) returns
> only 2 of the 3 desired collection paths.

I think we're missing some context: Why do you expect 3 paths from
`(current-library-collection-paths)`?

A normal configuration would have just 2 paths, but it's possible to
have more due to command-line flags, environment variables, or
configuration in "config.rktd". Do you expect 3 because you have an
environment variable set, or something like that?


> Should I use info.rkt to specify the 3 desired collection paths?

An "info.rkt" file will not change the collection-paths parameter.
Normally, instead of adding new collection paths, new collections are
added through packages. Those packages are found through the
`current-library-collection-links` parameter, which points to files
that contain more paths.


Matthew

Don Green

unread,
Jun 4, 2021, 5:15:11 PM6/4/21
to Racket Users
To answer Mathew Flatt's question: "Do you expect 3" (paths) "because you have an

environment variable set, or something like that? "
Answer: Yes. I can run a shell file that contains:
#! /bin/bash
export PLTCOLLECTS="/home/don/.plt-scheme/4.2.1/collects:"

Many of my programs are accessible from that path.
-----------
Sounds like ideally I should begin creating my own pkg(s) that are outside a collection path, and link it by specifying a current-library-collection-links parameter.

In the mean time I'd like to add the collection path.
-----------
Currently,
When I open DrRacket and run: (current-library-collection-paths) it returns:
'(#<path:/home/don/.plt-scheme/4.2.1/collects> #<path:/home/don/.racket/8.1/collects> #<path:/home/don/racket/collects/>)
which is correct and no problems, however
when I click on a .ss file in the file-manager, the file is opened in drracket v.8.1 but
(current-library-collection-paths) returns only:
'(#<path:/home/don/.racket/8.1/collects> #<path:/home/don/racket/collects/>)

The problem seems to be that the file-manager needs to set PLTCOLLECTS="/home/don/.plt-scheme/4.2.1/collects:
to set the env. variable so that drracket can find #<path:/home/don/.plt-scheme/4.2.1/collects>.

Is there a more convenient method to achieve what I am after by making some configuration in racket rather than in my file-manager?

Matthew Flatt

unread,
Jun 6, 2021, 8:39:30 AM6/6/21
to Don Green, Racket Users
At Fri, 4 Jun 2021 14:15:11 -0700 (PDT), Don Green wrote:
> Sounds like ideally I should begin creating my own pkg(s) that are
> outside a collection path, and link it by specifying a
> current-library-collection-links parameter.

Yes, you should use packages. You normally shouldn't need to set the
`current-library-collection-links` parameter, though. Installing a
package will add to the links that are read via
`current-library-collection-links`

> In the mean time I'd like to add the collection path.
> -----------
> Currently,
> When I open DrRacket and run: (current-library-collection-paths) it returns:
> '(#<path:/home/don/.plt-scheme/4.2.1/collects>
> #<path:/home/don/.racket/8.1/collects> #<path:/home/don/racket/collects/>)
> which is correct and no problems, however
> when I click on a .ss file in the file-manager, the file is opened in
> drracket v.8.1 but
> (current-library-collection-paths) returns only:
> '(#<path:/home/don/.racket/8.1/collects> #<path:/home/don/racket/collects/>)

This is really a question about how your OS deals with environment
variables and programs that you launch through its graphical interface.
It looks like you're on a Unix-like platform; unfortunately, I don't
know how quite things will work there.

> Is there a more convenient method to achieve what I am after by making some
> configuration in racket rather than in my file-manager?

Although it's not the way Racket programmers normally work, there is an
option within DrRacket's GUI:

Open the "Choose Language..." dialog from the "Language" menu, then
select "Show Details". There's a configuration panel roughly in the
middle of the right-hand side for adding collects paths.
Reply all
Reply to author
Forward
0 new messages