emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/realgud 52fac1f 48/72: add realgud:window-locals-undist


From: Stefan Monnier
Subject: [elpa] externals/realgud 52fac1f 48/72: add realgud:window-locals-undisturb-src
Date: Fri, 26 Mar 2021 22:49:11 -0400 (EDT)

branch: externals/realgud
commit 52fac1f727d00d102c23eabe4117d12862e7a88a
Author: 813 <813gan@protonmail.com>
Commit: 813 <813gan@protonmail.com>

    add realgud:window-locals-undisturb-src
    
    since now locals window is immediately visible after creation,
    just like other windows
---
 realgud/common/window.el | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/realgud/common/window.el b/realgud/common/window.el
index 28057a4..1677000 100644
--- a/realgud/common/window.el
+++ b/realgud/common/window.el
@@ -178,6 +178,41 @@ See also `realgud-window-src'"
     src-window)
   )
 
+(defun realgud:window-locals-undisturb-src ( &optional opt-buffer switch?)
+  "Make sure the locals buffer is displayed in windows without
+disturbing the source window if it is also displayed. Returns
+the source window
+See also `realgud-window-src'"
+  (interactive)
+  (let* ((buffer (or opt-buffer (current-buffer)))
+        (src-buffer (realgud-get-srcbuf buffer))
+        (src-window (get-buffer-window src-buffer))
+        (cmd-buffer (realgud-get-cmdbuf buffer))
+        (cmd-window (get-buffer-window cmd-buffer))
+        (locals-buffer (realgud-get-locals-buf cmd-buffer))
+        (locals-window (get-buffer-window locals-buffer))
+        (window (selected-window))
+        )
+    (when cmd-buffer
+      (unless locals-window
+       (setq locals-window
+             (if (eq window src-window)
+                 ;; FIXME: generalize what to do here.
+                 (if (one-window-p 't)
+                     (split-window)
+                   (next-window window 'no-minibuf))
+               window))
+       (set-window-buffer locals-window locals-buffer)
+       )
+      (if switch?
+         (and (select-window locals-window)
+              (switch-to-buffer locals-buffer)))
+
+      )
+    src-window)
+  )
+
+
 (defun realgud:window-bt()
   "Refresh backtrace information and display that in a buffer"
   (interactive)
@@ -203,6 +238,7 @@ See also `realgud-window-src'"
   (interactive)
   (with-current-buffer-safe (realgud-get-cmdbuf)
     (realgud-locals-init)
+    (realgud:window-locals-undisturb-src)
     )
   )
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]