2017-02-27 7 views
1

現在、emacsのフライチェックはデフォルトでjsに対して有効になっています。私はglobal-flycheck-modeを使用していますが、その値をリストとして設定しているかどうかはわかりません。 json-mode、web-mode、C++モードのような他のモードでflycheckを有効にする方法は不思議です。フライチェックの設定はこちらですフライチェックを他のモードで有効にする

;; ===================flycheck settings start==================== 
;; use web-mode for .jsx files 
(add-to-list 'auto-mode-alist '("\\.jsx$" . web-mode)) 

;; http://www.flycheck.org/manual/latest/index.html 
(require 'flycheck) 

;; turn on flychecking globally 
(add-hook 'after-init-hook #'global-flycheck-mode) 

;; disable jshint since we prefer eslint checking 
(setq-default flycheck-disabled-checkers 
       (append flycheck-disabled-checkers 
         '(javascript-jshint))) 

;; use eslint with web-mode for jsx files 
(flycheck-add-mode 'javascript-eslint 'web-mode) 

;; customize flycheck temp file prefix 
(setq-default flycheck-temp-prefix ".flycheck") 

;; disable json-jsonlist checking for json files 
(setq-default flycheck-disabled-checkers 
       (append flycheck-disabled-checkers 
         '(json-jsonlist))) 

;; https://github.com/purcell/exec-path-from-shell 
;; only need exec-path-from-shell on OSX 
;; this hopefully sets up path and other vars better 
(when (memq window-system '(mac ns)) 
    (exec-path-from-shell-initialize)) 

;; for better jsx syntax-highlighting in web-mode 
;; - courtesy of Patrick @halbtuerke 
(defadvice web-mode-highlight-part (around tweak-jsx activate) 
    (if (equal web-mode-content-type "jsx") 
     (let ((web-mode-enable-part-face nil)) 
     ad-do-it) 
    ad-do-it)) 

;; c++ 
(add-hook 'c++-mode-hook (lambda() (setq flycheck-gcc-language-standard "c++11"))) 
;; ===================flycheck settings end====================== 

答えて

0

現在、この1つを使用しています。正常に動作します。

;; Enable for other modes 
(add-hook 'c++-mode-hook 'flycheck-mode) 
(add-hook 'web-mode-hook 'flycheck-mode) 
(add-hook 'json-mode-hook 'flycheck-mode) 

しかし、以前はjs2モードでしか使用できなかった理由はまだ分かりません。

関連する問題