branch: externals/dape
commit c8f6f248494f22226381cec1d5b644b05494bb9c
Author: Daniel Pettersson <dan...@dpettersson.net>
Commit: Daniel Pettersson <dan...@dpettersson.net>

    Add dape-many-windows to ease restoring and customizing displayed windows
---
 dape.el | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/dape.el b/dape.el
index 5810534763..8a76d752d9 100644
--- a/dape.el
+++ b/dape.el
@@ -1300,6 +1300,29 @@ them then executes BODY."
   "If `display-graphic-p' focus Emacs."
   (select-frame-set-input-focus (selected-frame)))
 
+(define-minor-mode dape-many-windows
+  "Display complex window layout if t and simple if nil.
+The mode modifies `dape-start-hook' to remove or add the complex
+layout for future debugging sessions."
+  :global t
+  :init-value t
+  ;; Add or remove info buffers from `buffer-list' and hooks, based on
+  ;; `dape-many-windows'.
+  (if dape-many-windows
+      (progn (add-hook 'dape-start-hook #'dape-info)
+             (dape-info nil))
+    (remove-hook 'dape-start-hook #'dape-info)
+    (cl-loop for buffer in (dape--info-buffer-list)
+             for window = (get-buffer-window buffer)
+             when window do (quit-window t window)))
+  ;; And make sure that Shell and Repl is displayed
+  (when-let* ((buffer (get-buffer "*dape-shell*")))
+    (dape--display-buffer buffer))
+  (when-let* ((buffer (get-buffer "*dape-repl*"))
+              (window (get-buffer-window buffer)))
+    (quit-window nil window))
+  (dape-repl))
+
 
 ;;; Connection
 

Reply via email to