Skip to content

Commit f4fa353

Browse files
committed
Add php-default-major-mode instead of (function php-mode)
1 parent 6631cae commit f4fa353

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

php.el

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ You can replace \"en\" with your ISO language code."
7979
:group 'php
8080
:type 'string)
8181

82+
(defcustom php-default-major-mode 'php-mode
83+
"Major mode for edition PHP script."
84+
:group 'php
85+
:tag "PHP Default Major Mode"
86+
:type 'function)
87+
8288
(defcustom php-template-mode-alist
8389
'(("\\.blade" . web-mode)
8490
("\\.phpt\\'" . phpt-mode)
@@ -198,18 +204,15 @@ Look at the `php-executable' variable instead of the constant \"php\" command."
198204
'flymake-php-init)))))
199205
(list php-executable (cdr init))))
200206

201-
(eval-when-compile
202-
(declare-function php-mode "php-mode"))
203-
204207
;;;###autoload
205208
(defun php-mode-maybe ()
206209
"Select PHP mode or other major mode."
207210
(let ((mode (assoc-default buffer-file-name php-template-mode-alist #'string-match-p)))
208211
(when (and mode (not (fboundp mode)))
209212
(if (string-match-p "\\.blade\\." buffer-file-name)
210213
(warn "php-mode is NOT support blade template")
211-
(setq mode #'php-mode)))
212-
(funcall (or mode #'php-mode))))
214+
(setq mode nil)))
215+
(funcall (or mode php-default-major-mode))))
213216

214217
;;;###autoload
215218
(defun php-current-class ()

0 commit comments

Comments
 (0)