aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2017-08-24 15:08:27 +0200
committerGitHub <[email protected]>2017-08-24 15:08:27 +0200
commit9762af0851da245444173b22509462b90c7cc7c6 (patch)
tree6a76a23b95a59e25ff44dd34bb8f6e28389820ef
parent8539cf444bd1e79360ee2b68d2796a604b6723d1 (diff)
parent1162e24d46d855b779a796ad035e0f4d10e67f14 (diff)
downloadotp-9762af0851da245444173b22509462b90c7cc7c6.tar.gz
otp-9762af0851da245444173b22509462b90c7cc7c6.tar.bz2
otp-9762af0851da245444173b22509462b90c7cc7c6.zip
Merge pull request #1539 from johanclaesson/xrefref
Emacs: Fix default target for xref-find-references
-rw-r--r--lib/tools/emacs/erlang.el13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el
index 438abc2d29..012de479d3 100644
--- a/lib/tools/emacs/erlang.el
+++ b/lib/tools/emacs/erlang.el
@@ -3642,8 +3642,10 @@ The return value is a string of the form \"foo/1\"."
(error nil)))))
-;; Keeping erlang-get-function-under-point for backward compatibility.
-;; It is used by erldoc.el and maybe other code out there.
+;; erlang-get-function-under-point is replaced by
+;; erlang-get-identifier-at-point as far as internal erlang.el usage
+;; is concerned. But it is kept for backward compatibility. It is
+;; used by erldoc.el and maybe other code out there.
(defun erlang-get-function-under-point ()
"Return the module and function under the point, or nil.
@@ -4881,7 +4883,12 @@ considered first when it is time to jump to the definition.")
'(progn
(cl-defmethod xref-backend-identifier-at-point
((_backend (eql erlang-etags)))
- (erlang-id-to-string (erlang-get-identifier-at-point)))
+ (if (eq this-command 'xref-find-references)
+ (if (use-region-p)
+ (buffer-substring-no-properties (region-beginning)
+ (region-end))
+ (thing-at-point 'symbol))
+ (erlang-id-to-string (erlang-get-identifier-at-point))))
(cl-defmethod xref-backend-definitions
((_backend (eql erlang-etags)) identifier)