Configure Emacs for Erlang development

classic Classic list List threaded Threaded
5 messages Options
by
Reply | Threaded
Open this post in threaded view
|

Configure Emacs for Erlang development

by
Hi,

I followed the guide with link (From Adopting Erlang): 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
Reply | Threaded
Open this post in threaded view
|

Re: Configure Emacs for Erlang development

Nathaniel Waisbrot

By the way, I want to ask: what kind of editor configuration do you use to develop Erlang every day?


Although I always mean to get better at Emacs and fully customize it to perfection, I never have.

In lieu of personalization, I use Spacemacs (http://spacemacs.org/#) with the 'erlang' layer: http://spacemacs.org/layers/+lang/erlang/README.html

The only thing I need for Erlang support is the 'erlang' in the configuration-layers list of my .spacemacs file, which starts like this:

(defun dotspacemacs/layers ()
  "Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
  (setq-default
   dotspacemacs-distribution 'spacemacs
   dotspacemacs-enable-lazy-installation 'unused
   dotspacemacs-ask-for-lazy-installation t
   dotspacemacs-configuration-layer-path '()
   dotspacemacs-configuration-layers
   '(
     go
     lua
     ansible
     common-lisp
     csv
     docker
     emacs-lisp
     erlang
     git
     helm
     html
     javascript
     latex
     markdown
     org
     python
     ruby
     rust
     shell-scripts
     spell-checking
     systemd
     terraform
     yaml
     )
;; etc ...
Reply | Threaded
Open this post in threaded view
|

Re: Configure Emacs for Erlang development

Tristan Sloughter-4
In reply to this post by by
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/
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

by
Reply | Threaded
Open this post in threaded view
|

Re: Configure Emacs for Erlang development

by
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 <[hidden email]> 写道:


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/
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

by
Reply | Threaded
Open this post in threaded view
|

Re: Configure Emacs for Erlang development

by
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 <[hidden email]> 写道:

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 <[hidden email]> 写道:


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/
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