tonini / alchemist.el

Elixir Tooling Integration Into Emacs
http://www.alchemist-elixir.org
906 stars 103 forks source link

Workflow: recomendations and suggestions #252

Open 4ZM opened 7 years ago

4ZM commented 7 years ago

Getting started with alchemist (which is awesome!), all the commands are kind of overwhelming. Especially if you are new to Elixir. I'm unsure when to re-compile with mix after I've changed a module and when to reload the buffer in iex, etc.

I would really appreciate some documentation of an example workflow and what alchemist commands are used in each step. Something like: create a new project, create a module, create a test, modify the module, experiment a bit in iex, re run the tests and so on.

vasspilka commented 7 years ago

There is this refcard (spacemacs version). Also lot of info here http://alchemist.readthedocs.io/en/latest/basic_usage/

But its not really what you ask for, I guess most people tend to develop their own workflows, I'm quite new to both emacs (using spacemacs) and elixir, however if more people are interested I could try writing up a summary of what one can do with alchemist but it would be basic stuff, like looking up documentation, running tests and mix tasks, moving around in a project, compiling and last but not least using iex in emacs.

If you are both new to emacs and elixir, I would strongly suggest using spacemacs with the elixir layer, I think its a lot more beginner friendly

vasspilka commented 7 years ago

Also @tonini I would suggest putting a documentation link in the alchemist website http://www.alchemist-elixir.org/ (preferably somewhere noticeable). When I first wanted to learn more about alchemist I was looking all around and could not find the documentation link, it was only many days after that I realized where it was. I know its on the README however its just a small paragraph and I somehow missed it, guess someone else might miss it too.

tonini commented 7 years ago

Hi

Also @tonini I would suggest putting a documentation link in the alchemist website http://www.alchemist-elixir.org/ (preferably somewhere noticeable).

That's a good point, I'll add the link to the docs to the website later. Thanks 😄

4ZM commented 7 years ago

No example or recommended workflow?

vasspilka commented 7 years ago

To be fair, I asked if you wanted to see something written by me and you never replied.

4ZM commented 7 years ago

@vasspilka I'm sorry I was slow reacting to your post. I would love to see something like that! Apologies if my comment came across as rude, it was not my intention. I was just surprised the ticket was closed without a comment as to why.

I'm not new to emacs, but to Elixir and it's ecosystem of tools, emacs modes etc. Any hints on a smooth and productive workflow would be much appreciated.

vasspilka commented 7 years ago

@4ZM Ok, I'll fix something up in a blog post or something and share it here. Probably will be ready by the end of the week. I'd recommend to give the refcard https://github.com/tonini/alchemist.el/blob/master/doc/alchemist-refcard.pdf a look if you have not already, basically everything I'm going to say will involve commands from there, as well as some stuff inside iex.

4ZM commented 7 years ago

Looking forward to it!

tonini commented 7 years ago

About working with Documentation Lookup

Refcard

vasspilka commented 7 years ago

@4ZM I found myself in a busy weekend, so I most likely won't have time for article until sometime during the week, sorry for taking me long.

vasspilka commented 7 years ago

@4ZM Here is the first half of the article https://medium.com/@vasspilka/c35f460e04e1 sorry for taking me more that I said but lot of stuff happening, hopefully I'll have the whole article ready soon. Any feedback is more than wellcome

4ZM commented 7 years ago

Great stuff! Exactly what I was looking for. Looking forward to the rest of the blog.

Something that I would particularly like to get some info on in the next part is reloading in iex and how it fits together with mix compile in the workflow.

Say you're writing a phoenix app and you make a change to a controller. What then? I guess; compile it, run the tests, reload it in iex (if running the server there)? Or would you recommend running the phoenix app outside of iex in a shell? If changing multiple files you can compile them in one swoop with mix compile, Is there any way of reloading all of the changed modules in iex?

vasspilka commented 7 years ago

@4ZM Article finally finished. (Most likely will edit it a bit aswell) https://medium.com/@vasspilka/basic-workflow-for-alchemist-el-c35f460e04e1#.cytatqvhe

Sorry to not have responded here earlier.

I find using an external shell inside emacs with term is better than using iex -S mix phoenix.server with alchemist-iex-project-run, because with the latter IEx.pry complains some time. If you do iex -S mix phoenix.server phoenix should autocompile your files so you would only have to restart the server on very specific occasions e.g. new dependencies and other stuff. Phoenix has put a lot of work to automate all the compile stuff for both Elixir and Javascipt. In spacemacs we have this tab like thing called layouts (not sure if they are in vanilla emacs), you can have the phoenix server running in different layout for convienience. Or use an external shell, I do both depending on occasion and other stuff I'm working

Compiling to iex should be easy with alchemist-iex-compile-this-buffer, its not the whole project but I guess while you are working, you will only work on 1 file/buffer at a time, so It should suit your needs

4ZM commented 7 years ago

Great article! Thank you