Norns: Reload script on file change

Created on 14 Oct 2018  路  5Comments  路  Source: monome/norns

Hi!

I've been editing scripts via emacs' TRAMP mode. Maiden is awesome but home is comfortable :). It would be very slick if it were possible to reload the active script when it's file is written to. I imagine that this could be as simple as setting up a watcher (using inotify) when the script is loaded.

Against live reload

One large advantage of an explicit "run" button is a developer will never start code that breaks their active environment without explicitly meaning to. I think this is a pretty good argument _against_ live reload. Maybe it could be a user setting?

If this is something that makes sense, I'd love to try and tackle it. I'd just need to be pointed to where scripts are loaded in matron (I think).

Most helpful comment

after consideration i think it's not good default behavior. in my own editing i certainly save files at times i don't want a reload.

FYI you can run a separate command line with the matron REPL:

cd norns
./stop.sh
./crone.sh > /dev/null &
build/matron/matron

within the REPL you can do

Script.reload()

and it'll reload the script

All 5 comments

after consideration i think it's not good default behavior. in my own editing i certainly save files at times i don't want a reload.

FYI you can run a separate command line with the matron REPL:

cd norns
./stop.sh
./crone.sh > /dev/null &
build/matron/matron

within the REPL you can do

Script.reload()

and it'll reload the script

agreed with @tehn , i think you can configure emacs to send the reload command to matron via websocket or just restart matron on saving the script.

thirded. an auto-recompiling IDE is a nutty default behavior (though to be sure, some people have set things up that way.)

@jaredpereira it sounds like what you really want is an interface between emacs and the matron REPL. the latter is exposed via websocket, so this should be pretty doable - i'm not an elisp hacker but maybe you are.

given that, emacs users can customize in weird ways, like sending Script.reload() on a save hook, in the time-hallowed tradition of that platform.

[closing (wont fix), but feel free to continue discussion]

IDE is a nutty default behavior (though to be sure, some people have set things up that way.)

Yep, realizing this :sweat_smile:

Will take a stab at a mode for emacs! Not too proficient with elisp yet, but it sounds like a good opportunity to learn with it :).

Thanks for the pointers all!

@jaredpereira - if you do try to go the websocket route and run in to problems let me know.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

catfact picture catfact  路  7Comments

catfact picture catfact  路  9Comments

pq picture pq  路  6Comments

catfact picture catfact  路  13Comments

catfact picture catfact  路  13Comments