From bdf3709e105d0c97e4b516f52d96c9eb70b665de Mon Sep 17 00:00:00 2001 From: joddie Date: Fri, 27 Feb 2015 15:19:15 -0800 Subject: [PATCH] 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. --- drupal/etags.el | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drupal/etags.el b/drupal/etags.el index 6c23a7e..d502b45 100644 --- a/drupal/etags.el +++ b/drupal/etags.el @@ -47,12 +47,13 @@ "Get function arguments from etags TAGS." (when (and (boundp 'drupal/etags-rootdir) (file-exists-p (concat drupal/etags-rootdir "TAGS"))) - (with-current-buffer (find-tag-noselect symbol nil nil) - (goto-char (point-min)) - (when (re-search-forward - (format "function\\s-+%s\\s-*(\\([^{]*\\))" symbol) - nil t) - (match-string-no-properties 1))))) + (save-excursion + (with-current-buffer (find-tag-noselect symbol nil nil) + (goto-char (point-min)) + (when (re-search-forward + (format "function\\s-+%s\\s-*(\\([^{]*\\))" symbol) + nil t) + (match-string-no-properties 1)))))) (add-hook 'drupal-mode-hook #'drupal/etags-enable)