Skip to content

Commit 8f8afed

Browse files
committed
Set php-mode-maybe to auto-mode-alist as default
1 parent db61986 commit 8f8afed

File tree

2 files changed

+5
-18
lines changed

2 files changed

+5
-18
lines changed

php-mode-test.el

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,8 @@ an error."
271271
style from Drupal."
272272
(dolist (mode '(pear wordpress symfony2))
273273
;; the file written to has no significance, only the buffer
274-
(let ((tmp-filename (concat (make-temp-name temporary-file-directory) ".php")))
274+
(let ((tmp-filename (concat (make-temp-name temporary-file-directory) ".php"))
275+
(auto-mode-alist '(("\\.php\\'" . php-mode))))
275276
(with-php-mode-test ("issue-53.php")
276277
(search-forward "return $this->bar;")
277278
(should (equal (list "before-write-file" mode nil)

php-mode.el

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,23 +1600,9 @@ The output will appear in the buffer *PHP*."
16001600
(ad-activate 'fixup-whitespace)
16011601

16021602
;;;###autoload
1603-
(add-to-list 'auto-mode-alist
1604-
(cons
1605-
(eval-when-compile
1606-
(rx (or
1607-
;; File name extensions (ex. "*.php", "*.phtml")
1608-
(: "."
1609-
(or (: "php" (? (in "s345t")))
1610-
"amk"
1611-
"phtml"))
1612-
;; Full file names (ex. "/Makefile", "/Amkfile")
1613-
(: "/"
1614-
(or "Amkfile"
1615-
".php_cs"
1616-
".php_cs.dist")))
1617-
string-end))
1618-
'php-mode)
1619-
t)
1603+
(progn
1604+
(add-to-list 'auto-mode-alist '("\\.\\(?:php[s345]?\\|phtml\\)\\'" . php-mode-maybe))
1605+
(add-to-list 'auto-mode-alist '("\\.php_cs\\(?:\\.dist\\)?\\'" . php-mode)))
16201606

16211607
(provide 'php-mode)
16221608
;;; php-mode.el ends here

0 commit comments

Comments
 (0)