web-mode won't start automatically in Aquamacs

旧城冷巷雨未停 提交于 2019-12-12 01:36:11

问题


I can't seem to get the configuration to work properly, only if I create a new HTML it goes into web-mode, any other way it goes into de default html-mode.

I'm using Aquamacs 3.2 GNU Emacs 2.4.4.51.2

Though I have had this same problem with previous versions.

Here's my config file (Preferences.el):

;; This is the Aquamacs Preferences file.
;; Add Emacs-Lisp code here that should be executed whenever
;; you start Aquamacs Emacs. If errors occur, Aquamacs will stop
;; evaluating this file and print errors in the *Messags* buffer.
;; Use this file in place of ~/.emacs (which is loaded as well.)

;; Melpa
(require 'package) ;; You might already have this line
(add-to-list 'package-archives
             '("melpa" . "http://melpa.org/packages/") t)
(when (< emacs-major-version 24)
  ;; For important compatibility libraries like cl-lib
  (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize) ;; You might already have this line

(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.[gj]sp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))

I know this has been asked here:

Emacs (Aquamacs) web-mode not automatically activating for HTML files

But there didn't seem to be a concrete answer.

Could anyone may point me to what I'm doing wrong?


回答1:


Have you tried to put those lines at the end of your .emacs ?




回答2:


I received a working answer at the mailing list, though it uses magic-mode-alist:

(setq magic-mode-alist '(("<!DOCTYPE html" . web-mode)))


来源:https://stackoverflow.com/questions/23682845/emacs-aquamacs-web-mode-not-automatically-activating-for-html-files

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!