idris-mode icon indicating copy to clipboard operation
idris-mode copied to clipboard

Package load path

Open NobbZ opened this issue 5 years ago • 6 comments

I'm trying to set up emacs and idris working together with elba package manager.

There they have told me, to let idris search for packages in target/deps based on my project dir.

I hoped I could set a variable that holds idris package load path, such that this variable + idris-load-packages in a .dir-locals.el would help me.

But I can not find a variable that I could use to actually define the path that the internally started idris would use to look packages up.

NobbZ avatar Mar 20 '19 10:03 NobbZ

Hi there, thanks for looking into elba support! I think you might need to start by looking at idris-ipkg-mode.el and see what it provides. Then figure out what should be done to support elba from there.

On Mar 20, 2019, at 4:45 AM, Norbert Melzer [email protected] wrote:

I'm trying to set up emacs and idris working together with elba package manager.

There they have told me, to let idris search for packages in target/deps based on my project dir.

I hoped I could set a variable that holds idris package load path, such that this variable + idris-load-packages in a .dir-locals.el would help me.

But I can not find a variable that I could use to actually define the path that the internally started idris would use to look packages up.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

jsoo1 avatar Mar 23 '19 19:03 jsoo1

Hi @jsoo1, the work on elba side to support plugin integration is done (https://github.com/elba/elba/issues/43), and now it's pretty simple to enable it in idris-mode for emacs.

The main feature of elba for this is elba repl --ide-mode which can be used as a drop-in replacement for idris compiler. Elba will fetch dependency packages and build them and finally listen to stdin just like what idris compiler does. (--ide-mode-socket is also supported)

Any other parameters like --indent-with can be passed to idris compiler after a --. For example elba repl --ide-mode -- --indent-with 4 .

I think we can implement the integration as the these steps:

  1. check whether an elba.toml manifest exists in project root, if it does, check whether elba program is available, and if they are all good, switch from ipkg mode to elba mode.
  2. In elba mode, use elba repl --ide-mode instead of idris --ide-mode.
  3. Watch elba.toml and elba.lock, and reload elba repl --ide-moe if file got changed.

andylokandy avatar Apr 17 '19 09:04 andylokandy

I'd prefer if we just could swap out the Idris executable and setup some watches via config in for locals, this would make integration for other dependency managers a matter of them impleting the wrapper instead of Idris mode implementing support for their lock files.

NobbZ avatar Apr 17 '19 09:04 NobbZ

I like this idea. It also gives users control of what package manager to use. It might have drawback that we have to generalize the ipkg watch as well, which might cause backward compatibility problem. I think making *.ipkg to be default watch option can solve it.

andylokandy avatar Apr 17 '19 09:04 andylokandy

One more step forward: we can let the wrapper do the watch. Then the only thing we need is a toggle that can disable ipkg. Of course, the wrapper can ignore the -p input and nothing have to change.

andylokandy avatar Apr 17 '19 10:04 andylokandy

Yes I like the idea of having an interface for various package managers or build tools to implement, too. I think, though, that not much change will be required if Elba wants to own the compile step, too. I think it might be a matter of implementing the functions that pass arguments to the compiler and changing the idris binary name variable.

jsoo1 avatar Apr 17 '19 16:04 jsoo1