Skip to content

Commit bd08906

Browse files
committed
Add php-mode-debug command
This command is useful for PHPMode debugging and trouble reporting. In this change, we are aiming exclusively to collect variables. This command was inspired by `web-mode-debug`.
1 parent 811603f commit bd08906

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

php-mode.el

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,25 @@ After setting the stylevars run hooks according to STYLENAME
11511151

11521152
(put 'php-set-style 'interactive-form (interactive-form 'c-set-style))
11531153

1154+
(defun php-mode-debug ()
1155+
"Display informations useful for debugging PHP Mode."
1156+
(interactive)
1157+
(message "--- PHP-MODE DEBUG BEGIN ---")
1158+
(message "versions: %s; %s" (emacs-version) (php-mode-version))
1159+
(message "major-mode: %s" major-mode)
1160+
(message "minor-modes: %s" (cl-remove-if
1161+
(lambda (s) (string-match-p "global" (symbol-name s)))
1162+
minor-mode-list))
1163+
(message "custom variables: %s"
1164+
(cl-loop for (v type) in (custom-group-members 'php nil)
1165+
if (eq type 'custom-variable)
1166+
collect (list v (symbol-value v))))
1167+
(message "c-indentation-style: %s" c-indentation-style)
1168+
(message "c-style-variables: %s" (c-get-style-variables c-indentation-style nil))
1169+
(message "--- PHP-MODE DEBUG END ---")
1170+
(switch-to-buffer "*Messages*")
1171+
(goto-char (point-max)))
1172+
11541173
;;;###autoload
11551174
(define-derived-mode php-mode c-mode "PHP"
11561175
"Major mode for editing PHP code.

0 commit comments

Comments
 (0)