Skip to content

Commit 2bdede4

Browse files
committed
Set php-mode-maybe to auto-mode-alist as default
1 parent f4fa353 commit 2bdede4

File tree

2 files changed

+5
-18
lines changed

2 files changed

+5
-18
lines changed

Diff for: php-mode-test.el

+2-1
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)

Diff for: php-mode.el

+3-17
Original file line numberDiff line numberDiff line change
@@ -1562,23 +1562,9 @@ The output will appear in the buffer *PHP*."
15621562
(ad-activate 'fixup-whitespace)
15631563

15641564
;;;###autoload
1565-
(add-to-list 'auto-mode-alist
1566-
(cons
1567-
(eval-when-compile
1568-
(rx (or
1569-
;; File name extensions (ex. "*.php", "*.phtml")
1570-
(: "."
1571-
(or (: "php" (? (in "s345t")))
1572-
"amk"
1573-
"phtml"))
1574-
;; Full file names (ex. "/Makefile", "/Amkfile")
1575-
(: "/"
1576-
(or "Amkfile"
1577-
".php_cs"
1578-
".php_cs.dist")))
1579-
string-end))
1580-
'php-mode)
1581-
t)
1565+
(progn
1566+
(add-to-list 'auto-mode-alist '("\\.\\(?:php[s345]?\\|phtml\\)\\'" . php-mode-maybe))
1567+
(add-to-list 'auto-mode-alist '("\\.php_cs\\(?:\\.dist\\)?\\'" . php-mode)))
15821568

15831569
(provide 'php-mode)
15841570
;;; php-mode.el ends here

0 commit comments

Comments
 (0)