Emacs Erlang snippets

Continuing with my previous yasnippet for Ruby, here are some snippets for Erlang mode.

Installation

  • Create an erlang-mode directory under text-mode
  • Save the following code in a file named mod.

    #name : -module().
    #contributor : hitesh <hitesh.jasani gmail.com>
    # --
    -module(${1:$(file-name-nondirectory 
                   (file-name-sans-extension (buffer-file-name)))}).
    $0
    
    
  • Save the following code in a file named exp.

    #name : -export([]).
    #contributor : hitesh <hitesh.jasani gmail.com>
    # --
    -export([${1:start/0}]).
    $0
    
    
  • Save the following code in a file named imp.

    #name : -import([]).
    #contributor : hitesh <hitesh.jasani gmail.com>
    # --
    -import(${1:lists}, [${2:map/2, sum/1}]).
    $0
    
    
  • Add a hook in your .emacs to enable yas mode with erlang.

    (add-hook 'erlang-mode-hook 'yas/minor-mode-on)
    
    
tags: emacs, erlang

Comments

comments powered by Disqus