@@ -203,6 +203,12 @@ a completion list."
203
203
:type 'integer
204
204
:link '(url-link :tag " Built-in web server"
205
205
" https://www.php.net/manual/features.commandline.webserver.php" ))
206
+
207
+ (defcustom php-topsy-separator " > "
208
+ " Separator string for `php-topsy-beginning-of-defun-with-class' ."
209
+ :group 'php
210
+ :tag " PHP Topsy Separator"
211
+ :type 'string )
206
212
207
213
; ;; PHP Keywords
208
214
(defconst php-magical-constants
@@ -655,6 +661,31 @@ Look at the `php-executable' variable instead of the constant \"php\" command."
655
661
(if (string= class " " ) " " (concat " \\ " class " ::" ))
656
662
(if (string= namedfunc " " ) " " (concat namedfunc " ()" ))))))
657
663
664
+ (defun php-topsy-beginning-of-defun-with-class ()
665
+ " Return function signature and class name string for header line in topsy.
666
+
667
+ You can add the function to topsy with the code below:
668
+ \( add-to-list 'topsy-mode-functions '(php-mode . php-topsy-beginning-of-defun-with-class))"
669
+ (save-excursion
670
+ (goto-char (window-start ))
671
+ (mapconcat
672
+ #'identity
673
+ (append
674
+ (save-match-data
675
+ (save-excursion
676
+ (when (re-search-backward php--re-classlike-pattern nil t )
677
+ (font-lock-ensure (point ) (line-end-position ))
678
+ (list (string-trim (buffer-substring (point ) (line-end-position )))))))
679
+ (progn
680
+ (beginning-of-defun )
681
+ (font-lock-ensure (point ) (line-end-position ))
682
+ (list (string-trim
683
+ (replace-regexp-in-string
684
+ (eval-when-compile (rx bos " <?php" ))
685
+ " "
686
+ (buffer-substring (point ) (line-end-position )))))))
687
+ php-topsy-separator)))
688
+
658
689
;;;### autoload
659
690
(defun php-run-builtin-web-server (router-or-dir hostname port &optional document-root )
660
691
" Run PHP Built-in web server.
0 commit comments