slack1
2018-10-26 12:18:55

Oh wow


popa.bogdanp
2018-10-26 15:32:50

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?


popa.bogdanp
2018-10-26 15:33:04
(define-runtime-path-list
  migration-paths
  (sort
   (find-files
    (lambda (p)
      (string-suffix? (path-&gt;string p) ".sql"))
    (build-path 'up "migrations"))
   string-ci&lt;?))

this is how I’m using it


popa.bogdanp
2018-10-26 15:34:21

and my project structure looks like this:

├── migrations
│   └── 0001.sql
└── proj
    ├── migrations.rkt

greg
2018-10-26 15:37:08

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).


greg
2018-10-26 15:38:29

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


samth
2018-10-26 15:39:00

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


popa.bogdanp
2018-10-26 15:39:05

That makes sense, thanks!


samth
2018-10-26 15:39:11

(sorry for using you as my emacs help)


greg
2018-10-26 15:40:35

@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.


greg
2018-10-26 15:41:29

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)))


samth
2018-10-26 15:42:11

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


greg
2018-10-26 15:42:48

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 autoloads are happening.


greg
2018-10-26 15:43:05

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


samth
2018-10-26 15:43:35

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


greg
2018-10-26 15:44:00

oh package-delete


greg
2018-10-26 15:44:09

so many synonyms, so little time


samth
2018-10-26 15:45:25

also doesn’t exist


samth
2018-10-26 15:45:47

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


greg
2018-10-26 15:47:32

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


greg
2018-10-26 15:48:00

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


greg
2018-10-26 15:48:25

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


greg
2018-10-26 15:48:46

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


samth
2018-10-26 15:49:06

Melpa


greg
2018-10-26 15:50:30

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


samth
2018-10-26 15:51:28

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


samth
2018-10-26 15:52:07

ah but more clicking maybe worked


samth
2018-10-26 15:52:28

ah but that didn’t change the behavior


samth
2018-10-26 15:52:42

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


greg
2018-10-26 15:53:54

Do you have geiser package installed, too?


samth
2018-10-26 15:54:01

yes, and i can’t delete it


samth
2018-10-26 15:54:07

says it’s a system package


greg
2018-10-26 15:54:19

Hmmph.


samth
2018-10-26 15:54:39

ah, removing with apt


samth
2018-10-26 15:54:53

and success


greg
2018-10-26 15:54:56

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.


samth
2018-10-26 15:54:58

yay


greg
2018-10-26 15:55:24

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


samth
2018-10-26 15:55:39

thanks for the help


greg
2018-10-26 15:55:48

You’re welcome.


jay.somedon
2018-10-26 16:58:41

@jay.somedon has joined the channel


philip.mcgrath
2018-10-26 19:12:04

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.


notjack
2018-10-26 19:18:20

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


philip.mcgrath
2018-10-26 19:19:03

@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.)


philip.mcgrath
2018-10-26 19:29:19

@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.


greg
2018-10-26 22:24:07

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


philip.mcgrath
2018-10-26 23:22:52

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
2018-10-26 23:23:38

@oneendtoother has joined the channel