@@ -167,10 +167,18 @@ we are standing on a variable"
167
167
(if (eq 'font-lock-variable-name-face (get-text-property (point ) 'face ))
168
168
t nil ))
169
169
170
+ (defvar erl-function-definition-and-call-regex
171
+ (concat " ^" erlang-atom-regexp " \\ s *(.*)\\ s-*->.*(.*$" )
172
+ " Regex for finding functions with definition and body on the same line" )
173
+
170
174
(defvar erl-function-definition-regex
171
175
(concat " ^" erlang-atom-regexp " \\ s *(" )
172
176
" Regex for finding function definitions" )
173
177
178
+ (defvar erl-function-definition-with-arrow-regex
179
+ (concat " ^" erlang-atom-regexp " \\ s *(.*)\\ s-*->.*" )
180
+ " Regex for finding function definitions to the left of point" )
181
+
174
182
(defun erlang-in-arglist-p ()
175
183
(if (erlang-stop-when-inside-argument-list)
176
184
(save-excursion
@@ -180,11 +188,20 @@ we are standing on a variable"
180
188
t nil ))
181
189
nil ))
182
190
191
+ (defun erlang-on-function-definition-and-call-p ()
192
+ (save-excursion
193
+ (beginning-of-line )
194
+ (looking-at erl-function-definition-and-call-regex)))
195
+
183
196
(defun erlang-on-function-definition-p ()
184
197
(save-excursion
185
198
(beginning-of-line )
186
199
(looking-at erl-function-definition-regex)))
187
200
201
+ (defun erlang-point-left-of-arrow-p ()
202
+ (save-excursion
203
+ (if (looking-back erl-function-definition-with-arrow-regex)
204
+ nil t )))
188
205
189
206
; ;; lookup related things
190
207
@@ -341,6 +358,11 @@ we are standing on a variable"
341
358
(erl-find-source-pattern-under-point pattern))
342
359
((erlang-at-variable-p)
343
360
(erl-find-variable-binding))
361
+ ((erlang-on-function-definition-and-call-p)
362
+ (cond ((erlang-point-left-of-arrow-p)
363
+ (erl-who-calls (erl-target-node)))
364
+ (t
365
+ (erl-find-function-under-point))))
344
366
((erlang-on-function-definition-p)
345
367
(erl-who-calls (erl-target-node)))
346
368
(t
0 commit comments