Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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