仿写了一段, doctype html确实大宽松了,把<!>也加上,忽略注释中的字符这个不知道怎么搞定
(add-to-list 'magic-mode-alist (cons #'my-php-to-web-mode 'web-mode))
(defun my-php-to-web-mode()
"php文件打开时检查html字符转为使用web-mode"
(when buffer-file-name
(and (member (file-name-extension buffer-file-name) '("php" "inc"))
(re-search-forward "\\(^\\s-*<!doctype html>\\)" magic-mode-regexp-match-limit t)
)))