당신은 호출 할 수 있습니다 g ++ 다음 플라이 메이크 구성으로 직접. 나는 다음 flymake-allowed-file-name-masks
를 호출 할 때 나는 스크린 샷을 다음있어
(require 'flymake)
(defun flymake-cc-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 "g++" (list "-Wall" "-Wextra" "-fsyntax-only" local-file))))
(push '("\\.cpp$" flymake-cc-init) flymake-allowed-file-name-masks)
(add-hook 'c++-mode-hook 'flymake-mode)
코멘트 버전입니다.
;; Import flymake
(require 'flymake)
;; Define function
(defun flymake-cc-init()
(let* (;; Create temp file which is copy of current file
(temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
;; Get relative path of temp file from current directory
(local-file (file-relative-name
temp-file
(file-name-directory buffer-file-name))))
;; Construct compile command which is defined list.
;; First element is program name, "g++" in this case.
;; Second element is list of options.
;; So this means "g++ -Wall -Wextra -fsyntax-only tempfile-path"
(list "g++" (list "-Wall" "-Wextra" "-fsyntax-only" local-file))))
;; Enable above flymake setting for C++ files(suffix is '.cpp')
(push '("\\.cpp$" flymake-cc-init) flymake-allowed-file-name-masks)
;; Enable flymake-mode for C++ files.
(add-hook 'c++-mode-hook 'flymake-mode)
도움 주셔서 대단히 감사합니다. 전에 lisp을 사용 해본 적이 없으므로 코드의 각 행이 무엇을하고 있는지 간단히 설명 할 수 있습니까? 많은 분들께 다시 한번 감사드립니다. – Arrakis
코멘트를 참조하십시오. version code (미안 해요 영어가 가난합니다). 플라이 메이크 모드를 다른 프로그래밍 언어로 사용한다면 flycheck (https://github.com/lunaryorn/flycheck)를 참조하십시오. flycheck은 많은 언어를 지원하므로 약간의 구성으로 flymake-mode를 사용할 수 있습니다. 그러한 Lisp 함수를 작성할 필요가 없습니다. – syohex
@syohex 플라이 메이크가 특정 지연 후 오류를 표시하도록 할 수 있습니까? – Tengis