Emacs - General Discussion, Blog Posts, Wiki

Emacs is an extensible editor for just about every operating system in existence. This page attempt to collect resources, blog posts, presentations about Elixir integration and tooling in the Emacs editor.

Major and minor modes:

Blog posts:

Emacs Foundations:

Configuration examples:

6 Likes

Spacemacs and Alchemist to make Elixir of immortality

3 Likes

Elixir documentation right at your fingertips with Alchemist

2 Likes

Alchemist: Elixir Tooling Integration Into Emacs

2 Likes

The best thing about Emacs is that it is easy to extend with new functionality. When you spot something that could be better for you, you have the option to make the change. If you see something in another editor you would like, you don’t have to change your editor, you can just spend a couple of evenings writing thousands upon thousands of lines of elisp to replicate the behaviour (j/k).

I wanted a short cut for highlighting words in test report buffers, and I wanted it to be bound to h. This was easily done by adding the following to my configuration:

(define-key alchemist-test-report-mode-map "h" #'highlight-phrase)

You can test it out by executing it in a scratch-buffer.

This is how you add keybindings to the alchemist test report keybindings.

2 Likes

Mastering Emacs is on discount right now and I’ve just read it through. I think this is a good book if you want to get into Emacs. I really like that it covers how to get help from within Emacs, so the reader should be able to ask emacs questions about emacs when done reading.

It doesn’t go into the elisp programming language, but it does cover some automatisation.

4 Likes

I decided to try emacs instead of atom since a lot of people speak so highly of Alchemist. Unfortunately so many things I take for granted are daunting in emacs. For example every ex file I open in a phoenix project I must enable alchemist-phoenix-mode, company-mode (which still haven’t figure how it works) and what else. Then if I close the buffer and open it again I have to reload the modes.

With atom I just do “atom .” and everything just works.

I am sure emacs can do the same and maybe more but it seems it needs a lot of time to research and try.

Can someone make a post or a quick guide how to set up emacs for a single elixir/phoenix project?

I hope it doesn’t look I am asking for free lunch here. I thought since this is a wiki it would be a nice addition and a great shortcut for us newbies.

1 Like

If you want something more friendly to novice user try Spacemacs - General Discussion, Blog Posts, Wiki

2 Likes

I have seen that thread. I also tried spacemacs and I didn’t like it because it felt very bloated and really confusing. I also have seen the guides mentioned in that thread. Unless I missed something none discusses how to set up a specific elixir project in emacs.

Try using spacemacs just install it and in your configuration add the elixir layer.
It took me 2-3 days to get into it (spacemacs is huuuge). But I fell in love!! Hope it helps.
Actually I just saw @mkunikow already suggested it above.

3 Likes

Emacs is an editor that you have to learn. As much as I want to help you I don’t see much hope your use of the word «daunting», because if you find this problem—setting up a hook for your Elixir configuration—to be daunting, then Emacs might not be the editor for you, because there will be a lot of tuning and goofing around in elisp before it will become the editor for you.

Have you tried following the excellent Alchemist guide? http://alchemist.readthedocs.io/en/latest/

2 Likes

FYI: Harley Hahn’s Emacs Field Guide (2016-08-06) is US$ 12.59 during the Apress 40% discount on new releases (until 2016-10-10).

amazon.com review - I have no idea if it is of any use …

See also goodreads.com ratings for Mastering Emacs which is still $US 25.00 for the time being (37% off - updated for Emacs 25).

1 Like

Hi. Maybe the word “daunting” is not the most appropriate and this may be because English is not my native language.

What I was trying to say is that in vanilla emacs24 every time I opened an .ex or .exs file I had to load elixir mode, company mode and who knows what else. Every time I opened a file. That is what I described as daunting.

Having used IDE’s and editors I thought that I had to, somehow, configure a config file inside my project folder in order for some things to work automatically. In atom you just do “atom .” and you have a project. Even when you open .exs files outside of a project it still recognizes it. I assumed that people did some kind of procedure every time they started a new project in emacs in order for alchemist to work. Now that I am older and wiser I know this is not the case. I also assumed that since it was working for everyone else they must be doing something that is so common sense that no one bothered to mention it. I did follow the guide but still couldn’t make it work.

I didn’t know about setting a hook for elixir configuration and my question was querying for tips like this.

Since then I followed the advice from @vasspilka and @mkunikow and tried again spacemacs. This time it looks way much better and many of my assumptions seem invalid.

Hi

Actually the elixir-mode and the alchemist-mode too gets initialized automatically when you open an .ex or .exs file. If thats doesn’t happens, the cause about this is that you need to require the packages by hand through: (require 'elixir-mode) for example. Spacemacs also uses the package use-package and always ensure the loading of the packages through (require ...). The package installation and interface Emacs have is package.el and people mostly think that it loads the installed packages by default. That’s actually was it does, but sometimes things can’t be loaded at a certain time in the load process and then you’re left behind alone with kinds of situations you encountered, a not loaded elixir-mode or alchemist-mode by default.

So if you go vanilla emacs, which I think thats a great idea :slight_smile:, load your packages by hand, use use-package or just plain (require ...).

Cheers

3 Likes

Hi there,

I am now doing research in both elixir-mode and alchemist minor mode.
I read some of the code in alchemist I see that each time alchemist starts it bootup alchemist-server and this server listen for request from emacs and reply back the answer. I see files under the alchemist-server directory. These files are in .exs extensions and files structures are not in mix project structure. My questions are

  1. What are reasons using .exs extensions here?
  2. Why not structure it in the mix project structure and when each time alchemist minor mode starts load up the whole mix project?

Thanks,
Dev.

1 Like

Hi, sorry to necro an old thread, but I didn’t want to start a new one just to ask this question.

Does anyone know of a folding plugin for Emacs? I yearn to hide @documentation sometimes when I want to look at just the code. I’ve tried a few plugins, but they don’t seem to actually hide the @docs.

4 Likes