Skip to content

Commit db61986

Browse files
committed
Add php-default-major-mode instead of (function php-mode)
1 parent 67954d1 commit db61986

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
@@ -86,6 +86,12 @@ You can replace \"en\" with your ISO language code."
8686
:group 'php
8787
:type 'string)
8888

89+
(defcustom php-default-major-mode 'php-mode
90+
"Major mode for edition PHP script."
91+
:group 'php
92+
:tag "PHP Default Major Mode"
93+
:type 'function)
94+
8995
(defcustom php-template-mode-alist
9096
'(("\\.blade" . web-mode)
9197
("\\.phpt\\'" . phpt-mode)
@@ -210,18 +216,15 @@ Look at the `php-executable' variable instead of the constant \"php\" command."
210216
'flymake-php-init)))))
211217
(list php-executable (cdr init))))
212218

213-
(eval-when-compile
214-
(declare-function php-mode "php-mode"))
215-
216219
;;;###autoload
217220
(defun php-mode-maybe ()
218221
"Select PHP mode or other major mode."
219222
(let ((mode (assoc-default buffer-file-name php-template-mode-alist #'string-match-p)))
220223
(when (and mode (not (fboundp mode)))
221224
(if (string-match-p "\\.blade\\." buffer-file-name)
222225
(warn "php-mode is NOT support blade template")
223-
(setq mode #'php-mode)))
224-
(funcall (or mode #'php-mode))))
226+
(setq mode nil)))
227+
(funcall (or mode php-default-major-mode))))
225228

226229
;;;###autoload
227230
(defun php-current-class ()

0 commit comments

Comments
 (0)