How to disable Emacs-Flymake for html mode

微笑、不失礼 提交于 2019-12-02 23:46:28

Remove the HTML entry from the list:

(delete '("\\.html?\\'" flymake-xml-init) flymake-allowed-file-name-masks)

OK I got it. here is what I did: first of all I found flymake.el file.(If you dont have it you probably have flymake.elc file under emacs installation.In that case just copy flymake.el file under your load path so it will be used instead of compiled version(.elc file) under insallation). than I found following function and commented .xml and .html bindings.

(defcustom flymake-allowed-file-name-masks
  '(("\\.\\(?:c\\(?:pp\\|xx\\|\\+\\+\\)?\\|CC\\)\\'" flymake-simple-make-init)
    ;("\\.xml\\'" flymake-xml-init)
    ;("\\.html?\\'" flymake-xml-init)
    ("\\.cs\\'" flymake-simple-make-init)
    ("\\.p[ml]\\'" flymake-perl-init)
    ("\\.php[345]?\\'" flymake-php-init)
    ("\\.h\\'" flymake-master-make-header-init flymake-master-cleanup)
    ("\\.java\\'" flymake-simple-make-java-init flymake-simple-java-cleanup)
    ("[0-9]+\\.tex\\'" flymake-master-tex-init flymake-master-cleanup)
    ("\\.tex\\'" flymake-simple-tex-init)
    ("\\.idl\\'" flymake-simple-make-init)
    ;; ("\\.cpp\\'" 1)
    ;; ("\\.java\\'" 3)
    ;; ("\\.h\\'" 2 ("\\.cpp\\'" "\\.c\\'")
    ;; ("[ \t]*#[ \t]*include[ \t]*\"\\([\w0-9/\\_\.]*[/\\]*\\)\\(%s\\)\"" 1 2))
    ;; ("\\.idl\\'" 1)
    ;; ("\\.odl\\'" 1)
    ;; ("[0-9]+\\.tex\\'" 2 ("\\.tex\\'")
    ;; ("[ \t]*\\input[ \t]*{\\(.*\\)\\(%s\\)}" 1 2 ))
    ;; ("\\.tex\\'" 1)
    )

Other comment outed lines was already there. Now flymake does not work for html and xml files

In the error message you receive it's telling that it can't find the command-line XML validation tool xml. You can fix it by installing a compatible XML validation tool (xmllint is the right choice I guess).

But if you really just want to disable Flymake for HTML and XML files you don't have to copy whole the flymake.el file and change it. Simply add this line your init file:

(defun flymake-xml-init ())

This overrides the function that Flymake calls for HTML and XML files with an empty function.

Customize the variable named flymake-allowed-file-name-masks.

You can do it like this too:

M-x customize-variable RET

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