aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tools/emacs/erlang.el
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tools/emacs/erlang.el')
-rw-r--r--lib/tools/emacs/erlang.el57
1 files changed, 24 insertions, 33 deletions
diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el
index aff2c4b2c9..3d20d86f43 100644
--- a/lib/tools/emacs/erlang.el
+++ b/lib/tools/emacs/erlang.el
@@ -3760,6 +3760,12 @@ In the future the list may contain more elements."
(if (assoc fk (cdr (car imports)))
(setq mod (car (car imports)))
(setq imports (cdr imports))))
+ (cond ((eq (preceding-char) ?#)
+ (setq fk (concat "-record(" fk)))
+ ((eq (preceding-char) ??)
+ (setq fk (concat "-define(" fk)))
+ ((and (null mod) (not (member fk erlang-int-bifs)))
+ (setq mod (erlang-get-module))))
(setq res (list mod fk)))))
(store-match-data md)
res)))
@@ -4661,9 +4667,25 @@ Tags can be given on the forms `tag', `module:', `module:tag'."
(set (make-local-variable 'find-tag-regexp-search-function)
'erlang-tags-regexp-search-forward)
(set (make-local-variable 'find-tag-tag-order)
- '(erlang-tag-match-module-p))
+ (mapcar #'erlang-make-order-function-aware-of-modules
+ erlang-tags-orig-tag-order))
(set (make-local-variable 'find-tag-regexp-tag-order)
- '(erlang-tag-match-module-regexp-p))))
+ (mapcar #'erlang-make-order-function-aware-of-modules
+ erlang-tags-orig-regexp-tag-order))))
+
+(defun erlang-make-order-function-aware-of-modules (f)
+ `(lambda (tag)
+ (let (mod)
+ (when (string-match ":" tag)
+ (setq mod (substring tag 0 (match-beginning 0)))
+ (setq tag (substring tag (match-end 0) nil)))
+ (and (funcall ',f tag)
+ (or (null mod)
+ (erlang-tag-at-point-match-module-p mod))))))
+
+(defun erlang-tag-at-point-match-module-p (mod)
+ (string-equal mod (erlang-get-module-from-file-name
+ (funcall (symbol-function 'file-of-tag)))))
(defun erlang-tags-remove-module-check ()
@@ -4740,37 +4762,6 @@ for a tag on the form `module:tag'."
(funcall erlang-tags-orig-regexp-search-function
tag bound noerror count)))
-
-;; t if point is at a tag line that matches TAG, containing
-;; module information. Assumes that all other order functions
-;; are stored in `erlang-tags-orig-[regex]-tag-order'.
-
-(defun erlang-tag-match-module-p (tag)
- (erlang-tag-match-module-common-p tag erlang-tags-orig-tag-order))
-
-(defun erlang-tag-match-module-regexp-p (tag)
- (erlang-tag-match-module-common-p tag erlang-tags-orig-regexp-tag-order))
-
-(defun erlang-tag-match-module-common-p (tag order)
- (let ((mod nil)
- (found nil))
- (if (string-match ":" tag)
- (progn
- (setq mod (substring tag 0 (match-beginning 0)))
- (setq tag (substring tag (match-end 0) nil))))
- (while (and order (not found))
- (setq found
- (and (not (memq (car order)
- '(erlang-tag-match-module-p
- erlang-tag-match-module-regexp-p)))
- (funcall (car order) tag)))
- (setq order (cdr order)))
- (and found
- (or (null mod)
- (string= mod (erlang-get-module-from-file-name
- (funcall (symbol-function 'file-of-tag))))))))
-
-
;;; Tags completion, Emacs 19 `etags' specific.
;;;
;;; The basic idea is to create a second completion table `erlang-tags-