Skip to content

Commit bdf3709

Browse files
committed
Fix bug in drupal/etags-get-function-args
With eldoc enabled, this function could move point unexpectedly to the end of line when point was on the *definition* of anything listed in the TAGS file. (This is due to the `find-tag-noselect`, which can return the already-open buffer for a given tag's file, if one exists). Adding a `save-excursion` around the `with-current-buffer` fixes this bug.
1 parent cf0364c commit bdf3709

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

drupal/etags.el

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,13 @@
4747
"Get function arguments from etags TAGS."
4848
(when (and (boundp 'drupal/etags-rootdir)
4949
(file-exists-p (concat drupal/etags-rootdir "TAGS")))
50-
(with-current-buffer (find-tag-noselect symbol nil nil)
51-
(goto-char (point-min))
52-
(when (re-search-forward
53-
(format "function\\s-+%s\\s-*(\\([^{]*\\))" symbol)
54-
nil t)
55-
(match-string-no-properties 1)))))
50+
(save-excursion
51+
(with-current-buffer (find-tag-noselect symbol nil nil)
52+
(goto-char (point-min))
53+
(when (re-search-forward
54+
(format "function\\s-+%s\\s-*(\\([^{]*\\))" symbol)
55+
nil t)
56+
(match-string-no-properties 1))))))
5657

5758
(add-hook 'drupal-mode-hook #'drupal/etags-enable)
5859

0 commit comments

Comments
 (0)