Skip to content

Commit 68736b6

Browse files
committed
Move php-get-pattern function into php.el
1 parent 7954afb commit 68736b6

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

lisp/php-mode.el

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,27 +1355,6 @@ current `tags-file-name'."
13551355
collect (replace-regexp-in-string
13561356
"-" "_" (substring file (match-beginning 1) (match-end 1)) t)))
13571357

1358-
;; Find the pattern we want to complete
1359-
;; find-tag-default from GNU Emacs etags.el
1360-
(defun php-get-pattern ()
1361-
(save-excursion
1362-
(while (looking-at "\\sw\\|\\s_")
1363-
(forward-char 1))
1364-
(if (or (re-search-backward "\\sw\\|\\s_"
1365-
(save-excursion (beginning-of-line) (point))
1366-
t)
1367-
(re-search-forward "\\(\\sw\\|\\s_\\)+"
1368-
(save-excursion (end-of-line) (point))
1369-
t))
1370-
(progn (goto-char (match-end 0))
1371-
(buffer-substring-no-properties
1372-
(point)
1373-
(progn (forward-sexp -1)
1374-
(while (looking-at "\\s'")
1375-
(forward-char 1))
1376-
(point))))
1377-
nil)))
1378-
13791358
(defun php-show-arglist ()
13801359
"Show function arguments at cursor position."
13811360
(interactive)

lisp/php.el

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,28 @@ can be used to match against definitions for that classlike."
419419
(when (re-search-backward re-pattern nil t)
420420
(match-string-no-properties 1)))))
421421

422+
(defun php-get-pattern ()
423+
"Find the pattern we want to complete.
424+
`find-tag-default' from GNU Emacs etags.el"
425+
(save-excursion
426+
(save-match-data
427+
(while (looking-at "\\sw\\|\\s_")
428+
(forward-char 1))
429+
(when (or (re-search-backward "\\sw\\|\\s_"
430+
(save-excursion (beginning-of-line) (point))
431+
t)
432+
(re-search-forward "\\(\\sw\\|\\s_\\)+"
433+
(save-excursion (end-of-line) (point))
434+
t))
435+
(goto-char (match-end 0))
436+
(buffer-substring-no-properties
437+
(point)
438+
(progn
439+
(forward-sexp -1)
440+
(while (looking-at "\\s'")
441+
(forward-char 1))
442+
(point)))))))
443+
422444
;;; Provide support for Flymake so that users can see warnings and
423445
;;; errors in real-time as they write code.
424446
(defun php-flymake-php-init ()

0 commit comments

Comments
 (0)