aboutsummaryrefslogtreecommitdiffhomepage
path: root/coq/coq.el
diff options
context:
space:
mode:
authorGravatar Paul Steckler <steck@stecksoft.com>2017-03-06 17:45:26 -0500
committerGravatar Paul Steckler <steck@stecksoft.com>2017-03-06 17:45:26 -0500
commit915ad2578489919e169fdcf4fe76a4f070268073 (patch)
tree99338966796471cfd6a0d8085448a11be3f0ffb5 /coq/coq.el
parent1d1c71d407ed843b01c019e88a5c4f786bfeecb9 (diff)
get threeb frames only when needed
Diffstat (limited to 'coq/coq.el')
-rw-r--r--coq/coq.el43
1 files changed, 22 insertions, 21 deletions
diff --git a/coq/coq.el b/coq/coq.el
index 4b9104f8..0c366df5 100644
--- a/coq/coq.el
+++ b/coq/coq.el
@@ -2673,27 +2673,28 @@ Only when three-buffer-mode is enabled."
;; https://github.com/cpitclaudel/company-coq/issues/8.
(unless (memq 'no-response-display proof-shell-delayed-output-flags)
;; If there is no frame with goql+response then do nothing
- (let ((threeb-frames (coq-find-threeb-frames)))
- (when (and proof-three-window-enable threeb-frames)
- (let ((pg-frame (car threeb-frames))) ; selecting one adequate frame
- (with-selected-frame pg-frame
- (let ((response-window (get-buffer-window proof-response-buffer t))
- (goals-window (get-buffer-window proof-goals-buffer t)))
- (when (and response-window
- (> (frame-height) 10))
- (with-selected-window response-window
- (with-current-buffer proof-response-buffer
- (let* ((response-height (window-text-height response-window))
- (goals-height (window-text-height goals-window))
- (maxhgth (- (+ response-height goals-height)
- window-min-height))
- (nline-resp ; number of lines we want for response buffer
- (min maxhgth (max window-min-height ; + 1 for comfort
- (+ 1 (count-lines (point-max) (point-min)))))))
- (unless (is-not-split-vertic (selected-window))
- (shrink-window (- response-height nline-resp)))
- (goto-char (point-min))
- (recenter))))))))))))
+ (when proof-three-window-enable
+ (let ((threeb-frames (coq-find-threeb-frames)))
+ (when threeb-frames
+ (let ((pg-frame (car threeb-frames))) ; selecting one adequate frame
+ (with-selected-frame pg-frame
+ (let ((response-window (get-buffer-window proof-response-buffer t))
+ (goals-window (get-buffer-window proof-goals-buffer t)))
+ (when (and response-window
+ (> (frame-height) 10))
+ (with-selected-window response-window
+ (with-current-buffer proof-response-buffer
+ (let* ((response-height (window-text-height response-window))
+ (goals-height (window-text-height goals-window))
+ (maxhgth (- (+ response-height goals-height)
+ window-min-height))
+ (nline-resp ; number of lines we want for response buffer
+ (min maxhgth (max window-min-height ; + 1 for comfort
+ (+ 1 (count-lines (point-max) (point-min)))))))
+ (unless (is-not-split-vertic (selected-window))
+ (shrink-window (- response-height nline-resp)))
+ (goto-char (point-min))
+ (recenter)))))))))))))
;; TODO: remove/add hook instead?
(defun coq-optimise-resp-windows-if-option ()