reddit / emacs

Does anyone have a good config for making expand-region play nicely with Elixir code?

hairlesscaveman · 2022-06-07 09:19
Whenever I do `expand-region` inside an Elixir code block I get the word at point, then the entire document. I'd love to get this working better as I use er a lot and it trips me up every time when working with Elixir code. Thanks in advance!
gammarray · 2022-06-07 16:14
Makes me wish Elixir were a lisp. Too bad support for clojerl and lfe is fringe at best these days.
[deleted] · 2022-06-07 16:16
[removed]
nullmove · 2022-06-08 08:17
I can get expansion to outer list, or outer function definition before entire document. But yes, doesn't work for generic individual blocks. Having no idea about how expand-region works, I looked into the repo. Seems like it needs to support specific modes. I looked into ruby-mode-expansions.el and yeah, it will take some work to make it work with Elixir :P Now I am speculating, but I think it would take less work to go through tree-sitter route. Seems that [emacs tree-sitter](https://github.com/emacs-tree-sitter/tree-sitter-langs/tree/master/repos) repo already supports Elixir. And then we would need to write Elixir specific queries for [combobulate](https://github.com/mickeynp/combobulate), which supports incremental selection à la expand-region.
[deleted] · 2022-06-08 10:40
[removed]
hairlesscaveman · 2022-06-09 12:23
Interesting, I wasn't aware of combobulate. I'll have to take a look!