Skip to content

Commit

Permalink
Fix `compiler-explorer-layout' in noninteractive mode
Browse files Browse the repository at this point in the history
* compiler-explorer.el (compiler-explorer-layout): Don't really do
anything in --batch (`noninteractive') mode.
  • Loading branch information
mkcms committed Jun 17, 2024
1 parent af7526d commit a8a56d5
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions compiler-explorer.el
Original file line number Diff line number Diff line change
Expand Up @@ -1629,17 +1629,22 @@ LAYOUT must be as described in `compiler-explorer-layouts'."
(do-it upper)
(with-selected-window lower-window
(do-it lower)))))))
(or layout (setq layout compiler-explorer-default-layout))
(when (numberp layout)
(setq layout (% layout (length compiler-explorer-layouts)))
(setq compiler-explorer--last-layout layout))
(when (window-dedicated-p)
(unless compiler-explorer--local-mode
(select-window (split-window-horizontally)))
(set-window-dedicated-p (selected-window) nil))
(delete-other-windows)
(do-it layout)
(balance-windows)))
(if noninteractive
(display-warning
'compiler-explorer
"Layout not possible as this is noninteractive Emacs session"
:note)
(or layout (setq layout compiler-explorer-default-layout))
(when (numberp layout)
(setq layout (% layout (length compiler-explorer-layouts)))
(setq compiler-explorer--last-layout layout))
(when (window-dedicated-p)
(unless compiler-explorer--local-mode
(select-window (split-window-horizontally)))
(set-window-dedicated-p (selected-window) nil))
(delete-other-windows)
(do-it layout)
(balance-windows))))

(defun compiler-explorer-load-example (example)
"Load an example named EXAMPLE.
Expand Down

0 comments on commit a8a56d5

Please sign in to comment.