Giter Club home page Giter Club logo

emacs-elixir's Introduction

elixir-mode -- Emacs major mode for Elixir

elixir-mode

Installation

Simply add to your load path and require the mode to install.

In your shell...

% git clone git://github.com/elixir-lang/emacs-elixir ~/.emacs.d/emacs-elixir
% $EDITOR ~/.emacs

In the editor...

(add-to-list 'load-path "~/.emacs.d/emacs-elixir")
(require 'elixir-mode-setup)
(elixir-mode-setup)

Save and reload with M-x load-file ~/.emacs.

Usage

Any file that matches the glob *.ex[s] or *.elixir is automatically opened in Elixir mode, but you can change this functionality easily.

;; Highlights *.elixir2 as well
(add-to-list 'auto-mode-alist '("\\.elixir2\\'" . elixir-mode))

Commands

(For the M-x prompt.)

elixir-mode

Switches to elixir-mode.

elixir-cos-mode

Applies compile-on-save minor mode.

elixir-mode-iex

Launch IEX inside Emacs.

elixir-mode-opengithub

Open the GitHub page for Elixir.

elixir-mode-compile-file

Compile Elixir files. Works fine on exs files, too, if needed.

elixir-mode-open-elixir-home

Go to Elixir README in the browser.

elixir-mode-show-version

Print version info for elixir-mode.

elixir-mode-indent-line

Indent the current line. (Buggy right now.)

Hooks

Hooks can be used to add functionality to elixir-mode. This example adds compile on save.

(defun elixir-mode-compile-on-save ()
  "Elixir mode compile files on save."
	(and (file-exists (buffer-file-name))
	     (file-exists (elixir-mode-compiled-file-name))
			 (elixir-cos-mode t)))
(add-hook 'elixir-mode-hook 'elixir-mode-compile-on-save)

Configuration

Custom variables for elixir-mode.

elixir-compiler-command (string)

Default: "elixirc"

Command to compile Elixir code.

elixir-iex-command (string)

Default: "iex"

Command to start an interactive REPL in IEX.

elixir-mode-highlight-operators (boolean)

Default: t

Should operators be colored? (Currently not working properly.)

elixir-mode-cygwin-paths (boolean)

Default: t

Should Cygwin paths be used on Windows?

elixir-mode-cygwin-prefix (string)

Default: "/cygdrive/C"

The prefix for Cygwin-style paths.

Keymapping

Keymaps can be added to the elixir-mode-map variable. There are no keyboard shortcuts included by default.

Bugs

This is still very alpha software; there are probably several bugs. Right now the indentation implementation needs some work, and the IEX mode appears entirely untested.

Notes

If you want to use ruby-end-mode for a more comfortable editing experience, you can add the following to your elixir-mode-hook:

(add-to-list 'elixir-mode-hook
             (defun auto-activate-ruby-end-mode-for-elixir-mode ()
               (set (make-variable-buffer-local 'ruby-end-expand-keywords-before-re)
                    "\\(?:^\\|\\s-+\\)\\(?:do\\)")
               (set (make-variable-buffer-local 'ruby-end-check-statement-modifiers) nil)
               (ruby-end-mode +1)))

History

This mode is based on the Emacs mode by secondplanet.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.