Search code examples
emacsflymake

How to disable Emacs-Flymake for html mode


Here is my flymake setup in .emacs file:

 (when (load "flymake" t) 
         (defun flymake-pyflakes-init () 
           (let* ((temp-file (flymake-init-create-temp-buffer-copy 
                              'flymake-create-temp-inplace)) 
              (local-file (file-relative-name 
                           temp-file 
                           (file-name-directory buffer-file-name)))) 
             (list "pyflakes" (list local-file)))) 

         (add-to-list 'flymake-allowed-file-name-masks 
                  '("\\.py\\'" flymake-pyflakes-init))) 

   (add-hook 'find-file-hook 'flymake-find-file-hook)
(load-library "flymake-cursor")

I want to use flymake only for .py files. and disable it for the rest. but It is always enabled. For example when I open an html file I always get following error Error (flymake): Flymake: Failed to launch syntax check process 'xml' with args (val /home/huseyin/vipsatis/templates/cancellation/base_flymake.html): Searching for program: no such file or directory, xml. Flymake will be switched OFF

So I want to turn it off for anything but py files. is it possible?

( For the people having the same problem, I want to explain the error message: Flymake uses xmlstarlet for xml and html validation. And it tries to call it as "xml val ......" but it has to call it as "xmlstarlet val...." to fix this you have to find flymake.el file and change the xml call with xmlstarlet. )


Solution

  • Remove the HTML entry from the list:

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