aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tools/emacs/erlang.el
diff options
context:
space:
mode:
authorSteve Vinoski <[email protected]>2013-09-11 06:44:27 -0400
committerAnthony Ramine <[email protected]>2013-12-12 12:54:25 +0100
commit4df233adc5a1d5ab54d3c7419a463ae1ef417c12 (patch)
tree450e6744f997d17f01306baeac6eee81db7203c5 /lib/tools/emacs/erlang.el
parenta929df291877df45c93303d22995bbbebf6a2c45 (diff)
downloadotp-4df233adc5a1d5ab54d3c7419a463ae1ef417c12.tar.gz
otp-4df233adc5a1d5ab54d3c7419a463ae1ef417c12.tar.bz2
otp-4df233adc5a1d5ab54d3c7419a463ae1ef417c12.zip
Support EEP37 named funs in emacs erlang-mode
Change emacs erlang-mode to recognize EEP37 named funs so they're indented properly. Specifically, modify erlang-partial-parse to allow for an optional Erlang variable name to appear between the "fun" keyword and the opening parenthesis of its argument list.
Diffstat (limited to 'lib/tools/emacs/erlang.el')
-rw-r--r--lib/tools/emacs/erlang.el6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el
index c395d22356..c1e9bec6ae 100644
--- a/lib/tools/emacs/erlang.el
+++ b/lib/tools/emacs/erlang.el
@@ -2600,6 +2600,12 @@ Value is list (stack token-start token-type in-what)."
(if (save-excursion
(goto-char (match-end 1))
(erlang-skip-blank to)
+ ;; Use erlang-variable-regexp here to look for an
+ ;; optional variable name to match EEP37 named funs.
+ (if (looking-at erlang-variable-regexp)
+ (progn
+ (goto-char (match-end 0))
+ (erlang-skip-blank to)))
(eq (following-char) ?\())
(erlang-push (list 'fun token (current-column)) stack)))
((looking-at "\\(begin\\|query\\)[^_a-zA-Z0-9]")