diff options
author | Johan Claesson <[email protected]> | 2017-09-05 22:06:38 +0200 |
---|---|---|
committer | Johan Claesson <[email protected]> | 2017-09-05 22:34:34 +0200 |
commit | 15867bb63d1d4109780652c5b3580870857b27b9 (patch) | |
tree | 189b1dc4198f2bff79f0ffbd292deb2ab28cbe6f /lib/tools/emacs | |
parent | 24dc0a81787336f54259a1212564785c93749eae (diff) | |
download | otp-15867bb63d1d4109780652c5b3580870857b27b9.tar.gz otp-15867bb63d1d4109780652c5b3580870857b27b9.tar.bz2 otp-15867bb63d1d4109780652c5b3580870857b27b9.zip |
Emacs: Guess type of tag definition in Emacs 24
This concerns tag finding commands in Emacs 24. If the word at point
is preceded by a hash suggest as default a jump to a record
definition. If it is a question mark suggest a macro. Otherwise
assume it is a function. If it is not a qualified call assume it is a
local function.
Diffstat (limited to 'lib/tools/emacs')
-rw-r--r-- | lib/tools/emacs/erlang.el | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el index 012de479d3..f3c3a6bae1 100644 --- a/lib/tools/emacs/erlang.el +++ b/lib/tools/emacs/erlang.el @@ -2083,12 +2083,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 @@ -3792,6 +3786,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) |