diff options
author | Dan Gudmundsson <[email protected]> | 2017-09-12 09:58:28 +0200 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2017-09-12 09:58:28 +0200 |
commit | 39c3d2ed3f6f7c15e7f726f0cb444d2b79775146 (patch) | |
tree | 1921809b11e18a0dbdb2b151efdc5fb4cfc4e0cc /lib | |
parent | 04541e8aca196dc76ecc585244ee168c37ddeec5 (diff) | |
parent | 54d87b64ba447371fb51f1ad7e773317e684843f (diff) | |
download | otp-39c3d2ed3f6f7c15e7f726f0cb444d2b79775146.tar.gz otp-39c3d2ed3f6f7c15e7f726f0cb444d2b79775146.tar.bz2 otp-39c3d2ed3f6f7c15e7f726f0cb444d2b79775146.zip |
Merge branch 'maint'
* maint:
Emacs: Update erlang-xref-find-definitions-module for Emacs 26
Emacs: Guess type of tag definition in Emacs 24
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tools/emacs/erlang.el | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el index 46256daca9..0cb6c3028f 100644 --- a/lib/tools/emacs/erlang.el +++ b/lib/tools/emacs/erlang.el @@ -2089,12 +2089,6 @@ This function is aware of imported functions." (when funcname (erlang-man-find-function (current-buffer) funcname)))))) -(defun erlang-default-function-or-module () - (let ((id (erlang-get-identifier-at-point))) - (if (eq (erlang-id-kind id) 'qualified-function) - (format "%s:%s" (erlang-id-module id) (erlang-id-name id)) - (erlang-id-name id)))) - ;; Should the defadvice be at the top level, the package `advice' would ;; be required. Now it is only required when this functionality @@ -3798,6 +3792,21 @@ of arguments could be found, otherwise nil." (nth 3 (erlang-id-to-list id))) +(defun erlang-default-function-or-module () + (erlang-with-id (kind module name) (erlang-get-identifier-at-point) + (let ((x (cond ((eq kind 'module) + (format "%s:" name)) + ((eq kind 'record) + (format "-record(%s" name)) + ((eq kind 'macro) + (format "-define(%s" name)) + (t + name)))) + (if module + (format "%s:%s" module x) + x)))) + + ;; TODO: Escape single quotes inside the string without ;; replace-regexp-in-string. (defun erlang-add-quotes-if-needed (str) @@ -5005,9 +5014,10 @@ considered first when it is time to jump to the definition.") (and (fboundp 'xref-make) (fboundp 'xref-make-file-location) (let* ((first-time t) + (cbuf (current-buffer)) xrefs matching-files) (save-excursion - (while (visit-tags-table-buffer (not first-time)) + (while (erlang-visit-tags-table-buffer (not first-time) cbuf) (setq first-time nil) (let ((files (tags-table-files))) (while files @@ -5023,6 +5033,10 @@ considered first when it is time to jump to the definition.") (setq files (cdr files)))))) (nreverse xrefs)))) +(defun erlang-visit-tags-table-buffer (cont cbuf) + (if (< emacs-major-version 26) + (visit-tags-table-buffer cont) + (visit-tags-table-buffer cont cbuf))) (defun erlang-xref-find-definitions-module-tag (module tag |