@@ -1161,22 +1161,27 @@ After setting the stylevars run hooks according to STYLENAME
11611161 (prog1 (php-set-style (symbol-name coding-style))
11621162 (remove-hook 'hack-local-variables-hook #'php-mode-set-style-delay )))))
11631163
1164- (defconst php-mode-debug--buffer-name " *PHP Mode DEBUG*" )
1164+ (defun php-mode-debug--buffer (&optional command &rest args )
1165+ " Return buffer for php-mode-debug, and execute `COMMAND' with `ARGS' ."
1166+ (with-current-buffer (get-buffer-create " *PHP Mode DEBUG*" )
1167+ (cl-case command
1168+ (init (erase-buffer )
1169+ (goto-address-mode ))
1170+ (top (goto-char (point-min )))
1171+ (insert (goto-char (point-max ))
1172+ (apply #'insert args)))
1173+ (current-buffer )))
11651174
11661175(defun php-mode-debug--message (format-string &rest args )
11671176 " Write message `FORMAT-STRING' and `ARGS' to debug buffer, like `message' ."
11681177 (declare (indent 1 ))
1169- (with-current-buffer php-mode-debug--buffer-name
1170- (goto-char (point-max ))
1171- (insert (apply #'format format-string args) " \n " )))
1178+ (php-mode-debug--buffer 'insert (apply #'format format-string args) " \n " ))
11721179
11731180(defun php-mode-debug ()
11741181 " Display informations useful for debugging PHP Mode."
11751182 (interactive )
11761183 (require 'cus-edit )
1177- (with-current-buffer (get-buffer-create php-mode-debug--buffer-name)
1178- (erase-buffer )
1179- (goto-address-mode ))
1184+ (php-mode-debug--buffer 'init )
11801185 (php-mode-debug--message " Feel free to report on GitHub what you noticed!" )
11811186 (php-mode-debug--message " https://github.com/ejmr/php-mode/issues/new" )
11821187 (php-mode-debug--message " " )
@@ -1207,7 +1212,7 @@ After setting the stylevars run hooks according to STYLENAME
12071212 (php-mode-debug--message " --- PHP-MODE DEBUG END ---" )
12081213 (php-mode-debug--message " ```\n " )
12091214 (php-mode-debug--message " Thank you!" )
1210- (pop-to-buffer php-mode-debug--buffer-name ))
1215+ (pop-to-buffer ( php-mode-debug--buffer 'top ) ))
12111216
12121217;;;### autoload
12131218(define-derived-mode php-mode c-mode " PHP"
0 commit comments