
Oh wow

I’m trying to use define-runtime-path-list
to create a path relative to my source file, but I think I might be doing something wrong. When I use a relative path and load the file inside racket-mode’s REPL, everything works. When I try to run the same file using the racket interpreter from the file’s parent directory, then things blow up with “fold-files: path disappeared: #<path:../migrations>”. Am I using define-runtime-path-list
wrong?

(define-runtime-path-list
migration-paths
(sort
(find-files
(lambda (p)
(string-suffix? (path->string p) ".sql"))
(build-path 'up "migrations"))
string-ci<?))
this is how I’m using it

and my project structure looks like this:
├── migrations
│ └── 0001.sql
└── proj
├── migrations.rkt

If you always expect the files to be ../migrations/*.sql
relative to migrations.rkt
? Instead I’d do something like (define-runtime-path here ".")
, then (build-path here 'up "migrations)
.

You really need just the one “anchor”, the location of migrations.rkt
, and you can do a normal build-path
relative to that. IIUC

@greg at some point, racket-mode stopped loading by default for .rkt files — what do I have to change to get that back?

That makes sense, thanks!

(sorry for using you as my emacs help)

@samth No that’s fine. Did it stop because you neglected to pay me the bitcoin license fee renewal? Otherwise it probably disappeared from Emacs’ auto-mode-alist
somehow.

This is what racket-mode does in racket-mode.el
to add itself to a few useful lists: ;;;###autoload
(progn
(add-to-list 'auto-mode-alist '("\\.rkt[dl]?\\'" . racket-mode))
(modify-coding-system-alist 'file "\\.rkt[dl]?\\'" 'utf-8)
(add-to-list 'interpreter-mode-alist '("racket" . racket-mode)))

my .emacs
does not change 'auto-mod-alist

You could try to figure out what other package is overwriting this; Geiser? Or just add the add-to-list
in your init file Or package-remove then re package-install racket-mode, to make sure its seen and the autoload
s are happening.

The last sounds like the best thing to try first, I think.

what’s the command to do that? package-remove doesn’t exist

oh package-delete

so many synonyms, so little time

also doesn’t exist

as in M-x package-delete
doesn’t do anything

It doesn’t prompt you “Delete package: ”?

Had you originally installed racket-mode from MELPA, or, using git clone?

Ugh I have to hop on a call any second now….

Sorry. Will try to check back in an hour or so if you’re still stuck.

Melpa

You could also try M-x list-packages, then use that UI to remove racket-mode, and install it again.

lovely, i found that, but there’s no uninstall button

ah but more clicking maybe worked

ah but that didn’t change the behavior

i successfully reinstalled the latest racket mode, still loads in Scheme mode

Do you have geiser package installed, too?

yes, and i can’t delete it

says it’s a system package

Hmmph.

ah, removing with apt

and success

Well I think in your init file you’ll just have to do that (add-to-list 'auto-mode-alist '("\\.rkt[dl]?\\'" . racket-mode))
after geiser mode does, somehow.

yay

Ah, good. I didn’t realize Geiser is installed as an OS package in some dists.

thanks for the help

You’re welcome.

@jay.somedon has joined the channel

Does anyone have a function like codeblock-pict
(http://docs.racket-lang.org/pict/More_Pict_Constructors.html#(def._((lib._pict%2Fcode..rkt)._codeblock-pict))) but for XML? I’m probably going to implement something like that for an upcoming talk, but it would be even better to not implement it.

@philip.mcgrath would it work if you made a #lang xml
?

@greg I know doing a normal build-path
on one “anchor” from define-runtime-path
works under “normal” conditions, and I use it a lot, but I’m not clear on whether it would register everything properly with the executable creator. (I’ve never tried to use the executable creator at all.)

@notjack That’s one option I’ve considered. The implementation of codeblock-pict
uses the lexer protocol from syntax-color
, so I might try to use that directly without going through a #lang
. I’ve also thought about using x-expressions, writing an XML pretty-printer for my notion of pretty (which has been on my to-do list for a while), and giving the pretty-printer a hook to emit picts instead of strings.

Good point. I don’t know, either. My odometer is zero for the executable creator.

It turns out that it works for children of the “anchor” directory, but not necessarily in the way you’d want: https://github.com/racket/racket/issues/2336

@oneendtoother has joined the channel