Skip to content

Commit cb8ffa8

Browse files
committed
Merge branch 'smie'
Update the indentation / syntax matching engine, bring the font-lock keyword list up to date and update URLs to point to the new repo. * smie: (35 commits) Highlight modules, records, protocols, impls as types Highlight private macros as function names, too Add a history section & link to the original author. Update one more URL in the README Update README with a working screenshot Update README for new setup instructions. Reorganize everything: Autoloads, requires, reindent elixir-mode.el Update README a bit Set tab widths for elixir files to the basic offset. Remove more outdated keywords, add some new ones. Update font-lock keywords for newest elixir. Indent if <cond>, do: <statement> correctly. Delurk old tokenizer helper function Have the lexer recognize parens, too Fix indentation of -> some more Use SMIE in elixir-mode by default. Upcase confusion in lookaround lexer. Try and be a bit smarter about highlighting some keywords Make tokenizer smarter w.r.t match statements Downcase literal strings read from the buffer ...
2 parents e31c520 + cc0470d commit cb8ffa8

File tree

4 files changed

+551
-251
lines changed

4 files changed

+551
-251
lines changed

README.markdown

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# elixir-mode -- Emacs major mode for [Elixir](https://github.com/josevalim/elixir)
1+
# elixir-mode -- Emacs major mode for [Elixir](http://elixir-lang.org/)
22

3-
![elixir-mode](https://img.skitch.com/20111112-tyhx1d5wqus29rx644f46ciu5c.png)
3+
![elixir-mode](http://cl.ly/image/0I3h1h1v2740/Screen%20Shot%202013-04-06%20at%205.40.05%20PM.png)
44

55
## Installation
66

@@ -9,26 +9,28 @@ Simply add to your load path and require the mode to install.
99
In your shell...
1010

1111
```shell
12-
% git clone git://github.com/secondplanet/elixir-mode ~/.emacs.d/elixir-mode
12+
% git clone git://github.com/elixir/emacs-elixir ~/.emacs.d/emacs-elixir
1313
% $EDITOR ~/.emacs
1414
```
1515
In the editor...
1616

1717
```lisp
18-
(add-to-list 'load-path "~/.emacs.d/elixir-mode")
19-
(require 'elixir-mode)
18+
(add-to-list 'load-path "~/.emacs.d/emacs-elixir)
19+
(require 'elixir-mode-setup)
20+
(elixir-mode-setup)
2021
```
2122

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

2425
## Usage
2526

26-
Any file that matches the glob `*.ex[s]` is automatically opened in
27-
Elixir mode, but you can change this functionality easily.
27+
Any file that matches the glob `*.ex[s]` or `*.elixir` is
28+
automatically opened in Elixir mode, but you can change this
29+
functionality easily.
2830

2931
```lisp
30-
;; Highlights *.elixir as well
31-
(add-to-list 'auto-mode-alist '("\\.elixir\\'" . elixir-mode))
32+
;; Highlights *.elixir2 as well
33+
(add-to-list 'auto-mode-alist '("\\.elixir2\\'" . elixir-mode))
3234
```
3335

3436
### Commands
@@ -119,11 +121,23 @@ There are no keyboard shortcuts included by default.
119121

120122
This is still very alpha software; there are probably several
121123
bugs. Right now the indentation implementation needs some work, and
122-
the operator and atom font-locking doesn't appear to be working
123-
correctly.
124+
the IEX mode appears entirely untested.
124125

125126
## Notes
126127

127-
This is my first Emacs mode, so please excuse some of the messy bits
128-
in the implementation. To help me out I had a look at and borrowed a
129-
bit of code from io-mode, ruby-mode, and coffee-mode.
128+
If you want to use `ruby-end-mode` for a more comfortable editing
129+
experience, you can add the following to your `elixir-mode-hook`:
130+
131+
```lisp
132+
(add-to-list 'elixir-mode-hook
133+
(defun auto-activate-ruby-end-mode-for-elixir-mode ()
134+
(set (make-variable-buffer-local 'ruby-end-expand-keywords-before-re)
135+
"\\(?:^\\|\\s-+\\)\\(?:do\\)")
136+
(set (make-variable-buffer-local 'ruby-end-check-statement-modifiers) nil)
137+
(ruby-end-mode +1)))
138+
```
139+
140+
## History
141+
142+
This mode is based on the
143+
[Emacs mode by secondplanet](https://github.com/secondplanet/elixir-mode).

elixir-mode-setup.el

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
;;; elixir-mode-setup.el --- Load and initialize major mode for Elixir files
2+
3+
(defconst elixir-mode-version "1.1.0"
4+
"Elixir mode version number.")
5+
(defconst elixir-mode-date "2013-04-06"
6+
"Elixir mode version date (bumped infrequently).")
7+
8+
(defun elixir-mode-setup ()
9+
(add-to-list 'auto-mode-alist '("\\.elixir\\'" . elixir-mode))
10+
(add-to-list 'auto-mode-alist '("\\.ex\\'" . elixir-mode))
11+
(add-to-list 'auto-mode-alist '("\\.exs\\'" . elixir-mode)))
12+
13+
14+
;;;### (autoloads (elixir-mode) "elixir-mode" "elixir-mode.el" (20832
15+
;;;;;; 47531))
16+
;;; Generated autoloads from elixir-mode.el
17+
18+
(defvar elixir-mode-hook nil)
19+
20+
(defvar elixir-mode-map (make-keymap) "\
21+
Elixir mode keymap.")
22+
23+
(autoload 'elixir-mode "elixir-mode" "\
24+
Major mode for editing Elixir files.
25+
26+
\(fn)" t nil)
27+
28+
;;;***
29+
30+
(provide 'elixir-mode-setup)
31+
;; Local Variables:
32+
;; no-byte-compile: t
33+
;; coding: utf-8
34+
;; End:
35+
;;; elixir-mode-setup.el ends here

0 commit comments

Comments
 (0)