Skip to content

Instantly share code, notes, and snippets.

@robertoaloi
Created November 21, 2012 12:17
Show Gist options
  • Save robertoaloi/4124582 to your computer and use it in GitHub Desktop.
Save robertoaloi/4124582 to your computer and use it in GitHub Desktop.
Improvement to the Erlang Mode for Emacs: Do not jump to a new line after -> when writing specs.
(defun erlang-after-arrow ()
"Return true if point is immediately after a function arrow (`->').
Make a special case when in a spec line."
(and
(save-excursion
(beginning-of-line)
(not (save-match-data (looking-at "-\\(spec\\|type\\)"))))
(and (>= (point) 2)
(and
(save-excursion
(backward-char)
(eq (char-before (point)) ?-))
(or (not (listp erlang-electric-commands))
(memq 'erlang-electric-gt
erlang-electric-commands))
(not (erlang-in-literal))
(looking-at "\\s *\\(%.*\\)?$")
(erlang-test-criteria-list erlang-electric-arrow-criteria)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment