이 문제를 해결하는 방법에는 두 가지가 있다고 생각합니다.
제
는 는 후크`컴파일 - 마무리 기능 '을 사용하는 것이다
편집 처리가 완료 될 때 호출 unctions [F 목록]. 각 함수는 컴파일 버퍼, 및 프로세스 완료 방법을 설명하는 문자열의 두 인수로 호출됩니다.
이
(add-hook 'compilation-finish-functions 'my-compilation-finish-function)
(defun my-compilation-finish-function (buffer resstring)
"Shrink the window if the process finished successfully."
(let ((compilation-window-height (if (string-match-p "finished" resstring) 5 nil)))
(compilation-set-window-height (get-buffer-window buffer 0))))
내가 그 솔루션을 가지고있는 유일한 문제는 그것이 성공 문자열을 찾을 수에 의해 결정 결과 문자열에 "완료"할 수 있다는 가정이다 :이 같은 솔루션에 이르게
.
'compilation-handle-exit
- 에 exit-status를 명시 적으로 전달하는 다른 방법이 있습니다. 나는 출구 상황이 0이 아닌 경우 이 창을 축소시키는이 충고를 썼다.
(defadvice compilation-handle-exit (around my-compilation-handle-exit-shrink-height activate)
(let ((compilation-window-height (if (zerop (car (ad-get-args 1))) 5 nil)))
(compilation-set-window-height (get-buffer-window (current-buffer) 0))
ad-do-it))
참고 : 두 번째 컴파일을 할 때 *compilation*
윈도우가 계속 표시되면, 실패에 따라 더 큰 크기를 조정할 수 없습니다. 크기를 조정하려면 nil
대신 높이를 지정해야합니다.
(if (string-match-p "finished" resstring) 5 (/ (frame-height) 2))
nil
이 (/ (frame-height) 2)
로 대체 : 아마도이 원하는대로 (첫 번째 예제를 변경)하는 것