summaryrefslogtreecommitdiff
path: root/lib/tools/emacs/erlang-skels.el
diff options
context:
space:
mode:
authorBruce Yinhe <bruce@erlang.org>2014-11-04 09:17:18 +0100
committerBruce Yinhe <bruce@erlang.org>2014-11-04 09:17:18 +0100
commite4f1f02cd2e5fbb578197fa28cdf7aca31f7f28e (patch)
treea95adb4242e8c8db07695e4f639eae2c2b731c95 /lib/tools/emacs/erlang-skels.el
parent771242f27e7117712b61f901621d89332b3c45e1 (diff)
parentc33a95582798d1fb6933945918361e36b6f99610 (diff)
downloaderlang-e4f1f02cd2e5fbb578197fa28cdf7aca31f7f28e.tar.gz
Merge branch 'davidw/add-spec-skel' into maint
OTP-12283 * davidw/add-spec-skel: Removed extra space following paren First attempt at adding a skel for -spec's
Diffstat (limited to 'lib/tools/emacs/erlang-skels.el')
-rw-r--r--lib/tools/emacs/erlang-skels.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/tools/emacs/erlang-skels.el b/lib/tools/emacs/erlang-skels.el
index af2c687fdc..78929ac510 100644
--- a/lib/tools/emacs/erlang-skels.el
+++ b/lib/tools/emacs/erlang-skels.el
@@ -31,6 +31,7 @@
("Module" "module" erlang-skel-module)
("Author" "author" erlang-skel-author)
("Function" "function" erlang-skel-function)
+ ("Spec" "spec" erlang-skel-spec)
()
("Small Header" "small-header"
erlang-skel-small-header erlang-skel-header)
@@ -149,6 +150,10 @@ Please see the function `tempo-define-template'.")
"*The template of a function skeleton.
Please see the function `tempo-define-template'.")
+(defvar erlang-skel-spec
+ '("-spec " (erlang-skel-get-function-name) "(" (erlang-skel-get-function-args) ") -> undefined.")
+ "*The template of a -spec for the function following point.
+Please see the function `tempo-define-template'.")
;; Attribute templates
@@ -1679,6 +1684,16 @@ The first character of DD is space if the value is less than 10."
(substring date 4 7)
(substring date -4))))
+(defun erlang-skel-get-function-name ()
+ (save-excursion
+ (erlang-beginning-of-function -1)
+ (erlang-get-function-name)))
+
+(defun erlang-skel-get-function-args ()
+ (save-excursion
+ (erlang-beginning-of-function -1)
+ (erlang-get-function-arguments)))
+
;; Local variables:
;; coding: iso-8859-1
;; End: