Skip to content

Commit f88f437

Browse files
committed
Use save-excursion in php-show-arglist
1 parent 10e9f5e commit f88f437

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

php-mode.el

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,20 +1274,22 @@ current `tags-file-name'."
12741274
nil)))
12751275

12761276
(defun php-show-arglist ()
1277+
"Show function arguments at cursor position."
12771278
(interactive)
12781279
(let* ((tagname (php-get-pattern))
12791280
(buf (find-tag-noselect tagname nil nil))
12801281
arglist)
12811282
(with-current-buffer buf
1282-
(goto-char (point-min))
1283-
(when (re-search-forward
1284-
(format "function\\s-+%s\\s-*(\\([^{]*\\))" tagname)
1285-
nil t)
1286-
(setq arglist (buffer-substring-no-properties
1287-
(match-beginning 1) (match-end 1)))))
1283+
(save-excursion
1284+
(goto-char (point-min))
1285+
(when (re-search-forward
1286+
(format "function\\s-+%s\\s-*(\\([^{]*\\))" tagname)
1287+
nil t)
1288+
(setq arglist (buffer-substring-no-properties
1289+
(match-beginning 1) (match-end 1))))))
12881290
(if arglist
12891291
(message "Arglist for %s: %s" tagname arglist)
1290-
(message "Unknown function: %s" tagname))))
1292+
(message "Unknown function: %s" tagname))))
12911293

12921294
(defcustom php-search-documentation-browser-function nil
12931295
"Function to display PHP documentation in a WWW browser.

0 commit comments

Comments
 (0)