smart-compile
패키지를 Emacs에 설치하십시오.
당신이 C-x C-m
을 실행하는 처음 인 경우, 그것은 일반적으로 충분하다 (기본 명령을 변경하도록 요청합니다, 소스 코드를 컴파일하기 위해 init.el
또는 .emacs
(require 'compile)
(setq compilation-last-buffer nil)
;; save all modified buffers without asking before compilation
(setq compilation-ask-about-save nil)
(defun compile-again (ARG)
"Run the same compile as the last time.
With a prefix argument or no last time, this acts like M-x compile,
and you can reconfigure the compile args."
(interactive "p")
;; the following two lines create bug: split a new window every time
;; (if (not (get-buffer-window "*compilation*"))
;; (split-window-below))
(if (and (eq ARG 1) compilation-last-buffer)
(recompile)
(call-interactively 'smart-compile)))
(bind-key* "C-x C-m" 'compile-again)
;; create a new small frame to show the compilation info
;; will be auto closed if no error
(setq special-display-buffer-names
`(("*compilation*" . ((name . "*compilation*")
,@default-frame-alist
(left . (- 1))
(top . 0)))))
(setq compilation-finish-functions
(lambda (buf str)
(if (null (string-match ".*exited abnormally.*" str))
;;no errors, make the compilation window go away in a few seconds
(progn
(run-at-time
"1 sec" nil 'delete-windows-on
(get-buffer-create "*compilation*"))
(message "No Compilation Errors!")))))
사용 C-x C-m
에이를 추가). 그렇지 않으면 직접 컴파일하는 데 사용한 명령이 실행되고 원하는 경우 명령을 변경하려면 C-u C-x C-m
을 사용해야합니다. 현재 디렉토리 안에 Makefile
이 있으면 사용 여부를 묻는 메시지가 표시됩니다.
어쩌면이 답변은 귀하의 질문에 너무 많이 들지만 시도해보십시오.
전혀 작동하지 않습니다. – CodyChan