Configure Emacs for Erlang development

by by@REDACTED
Tue Nov 5 15:08:26 CET 2019


I got it!

Here is my working Emacs configuration for Erlang development:
====
;; for delight                                                                                                                  
(use-package delight
  :ensure t)

;; for flycheck                                                                                                                 
(use-package flycheck
  :ensure t
  :delight
  :config (global-flycheck-mode))

;; for ivy-erlang-complete                                                                                                      
(use-package ivy-erlang-complete
  :ensure t)

;; for company-erlang: auto complete                                                                                            
(add-hook 'erlang-mode-hook #'company-erlang-init)

;; for erlang                                                                                                                   
(use-package erlang
  :load-path (“/<PATH>/lib/erlang/lib/tools-3.2.1/emacs")
  :hook (after-save . ivy-erlang-complete-reparse)
  :custom (ivy-erlang-complete-erlang-root “/<PATH>/lib/erlang")
  :config (ivy-erlang-complete-init)
  :mode (("\\.erl?$" . erlang-mode)
     ("rebar\\.config$" . erlang-mode)
     ("relx\\.config$" . erlang-mode)
     ("sys\\.config\\.src$" . erlang-mode)
     ("sys\\.config$" . erlang-mode)
     ("\\.config\\.src?$" . erlang-mode)
     ("\\.config\\.script?$" . erlang-mode)
     ("\\.hrl?$" . erlang-mode)
     ("\\.app?$" . erlang-mode)
     ("\\.app.src?$" . erlang-mode)
     ("\\Emakefile" . erlang-mode)))
====
The trick is put ivy-erlang-complete after flycheck. A sequential issue :-)

The auto completion works after I use gsed(GNU sed) instead of  default sed(BSD sed) on macOS.

Yao


> 在 2019年11月4日,23:44,by <by@REDACTED> 写道:
> 
> Yes, same configuration may behave differently because of different package versions.
> 
> A working package does not mean it will keep working in future updates. The documentation and change log become significant in this case.
> 
> Yao
> 
>> 在 2019年11月4日,23:16,Tristan Sloughter <t@REDACTED> 写道:
>> 
>> 
>> Hey, that is from my config in adoptingerlang but I don't have it currently separated out and published. Though I did do that at one point to test this and hopefully can find that and I will upload that file and link to it from adoptingerlang.
>> 
>> I don't have a good answer for you right now, sadly when I see errors like that I tend to just keep refershing the Emacs and package registry and updating the packages... sometimes having to uninstall and reinstall packages and eventually it works.
>> 
>> Emacs package management is not the best.. hehe, as far as I know you can't specify a version of a package and can't lock dependencies.
>> 
>> Tristan
>> 
>> On Mon, Nov 4, 2019, at 06:30, by wrote:
>>> Hi,
>>> 
>>> I followed the guide with link (From Adopting Erlang): https://adoptingerlang.org/docs/development/setup/ <https://adoptingerlang.org/docs/development/setup/>
>>> Seems "ivy-erlang-complete" is not properly configured.
>>> 
>>> Here is some environment information:
>>> Erlang version: Erlang/OTP 22.1.4
>>> Emacs version: GNU Emacs 25.3.1
>>> 
>>> And here is my related ~/.emacs configuration for Erlang:
>>> ====
>>> ;; for ivy-erlang-complete                                                                                                      
>>> (use-package ivy-erlang-complete
>>>   :ensure t)
>>> 
>>> ;; for delight                                                                                                                  
>>> (use-package delight
>>>   :ensure t)
>>> 
>>> ;; for flycheck                                                                                                                 
>>> (use-package flycheck
>>>   :ensure t
>>>   :delight
>>>   :config (global-flycheck-mode))
>>> 
>>> ;; for erlang                                                                                                                   
>>> (use-package erlang
>>>   :load-path (“/<PATH>/lib/erlang/lib/tools-3.2.1/emacs")
>>>   :hook (after-save . ivy-erlang-complete-reparse)
>>>   :custom (ivy-erlang-complete-erlang-root "/<PATH>/lib/erlang")
>>>   :config (ivy-erlang-complete-init)
>>>   :mode (("\\.erl?$" . erlang-mode)
>>>      ("rebar\\.config$" . erlang-mode)
>>>      ("relx\\.config$" . erlang-mode)
>>>      ("sys\\.config\\.src$" . erlang-mode)
>>>      ("sys\\.config$" . erlang-mode)
>>>      ("\\.config\\.src?$" . erlang-mode)
>>>      ("\\.config\\.script?$" . erlang-mode)
>>>      ("\\.hrl?$" . erlang-mode)
>>>      ("\\.app?$" . erlang-mode)
>>>      ("\\.app.src?$" . erlang-mode)
>>>      ("\\Emakefile" . erlang-mode)))
>>> ====
>>> 
>>> When I restart my emacs with above configuration, I got error message as below:
>>> ====
>>> Error (use-package): erlang/:config: Symbol’s function definition is void: ivy-erlang-complete-setup-flycheck
>>> ====
>>> I have no clue about what happened.
>>> 
>>> An example ~/.emacs file related to Erlang would be very helpful.
>>> 
>>> I searched it with Google, but seems no typical configuration demo/example exist for configuring Emacs with Erlang.
>>> 
>>> By the way, I want to ask: what kind of editor configuration do you use to develop Erlang every day?
>>> 
>>> Yao
>> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20191105/da517e17/attachment.htm>


More information about the erlang-questions mailing list