[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/realgud 4a9c658 62/72: Add option to control orientatio
From: |
Stefan Monnier |
Subject: |
[elpa] externals/realgud 4a9c658 62/72: Add option to control orientation when splitting window. |
Date: |
Fri, 26 Mar 2021 22:49:14 -0400 (EDT) |
branch: externals/realgud
commit 4a9c658f41aa25cf95abec246bce7134e8ce6017
Author: yangyingchao <yangyingchao@gmail.com>
Commit: yangyingchao <yangyingchao@gmail.com>
Add option to control orientation when splitting window.
new option `realgud-window-split-orientation' can be set to:
- 'vertical: default value, behaves same as previous versions.
- 'horizontal: new, split window horizontally.
---
realgud/common/window.el | 62 +++++++++++++++++-------------------------------
1 file changed, 22 insertions(+), 40 deletions(-)
diff --git a/realgud/common/window.el b/realgud/common/window.el
index 1677000..bcb7cd2 100644
--- a/realgud/common/window.el
+++ b/realgud/common/window.el
@@ -26,6 +26,23 @@
(declare-function one-window-p(bool))
+(defcustom realgud-window-split-orientation 'vertical
+ "Orientation when splitting window."
+ :type '(choice (const :tag "Vertical" vertical)
+ (const :tag "Horizontal" horizontal))
+ :group 'realgud)
+
+(defun realgud-prepare-window (window)
+ "Setup layout based on WINDOW, then select and return a window."
+ (if (one-window-p 't)
+ (cond
+ ((eq realgud-window-split-orientation 'vertical)
+ (split-window-vertically))
+ ((eq realgud-window-split-orientation 'horizontal)
+ (split-window-horizontally))
+ (t (error "TODO: implement customized layout")))
+ (next-window window 'no-minibuf)))
+
(defun realgud-window-update-position (buffer marker)
"Update BUFFER to position specified with MARKER.
We assume MARKER points inside BUFFER"
@@ -61,17 +78,10 @@ See also `realgud-window-src'."
(src-window (get-buffer-window src-buffer))
(cmd-buffer (realgud-get-cmdbuf buffer))
(cmd-window (get-buffer-window cmd-buffer))
- (window (selected-window))
)
(if src-buffer
(unless src-window
- (setq src-window
- (if (eq window cmd-window)
- ;; FIXME: generalize what to do here.
- (if (one-window-p 't)
- (split-window)
- (next-window window 'no-minibuf))
- window))
+ (setq src-window (realgud-prepare-window (selected-window)))
(set-window-buffer src-window src-buffer))
)
(select-window src-window)
@@ -88,17 +98,10 @@ the source window."
(src-window (get-buffer-window src-buffer))
(cmd-buffer (realgud-get-cmdbuf buffer))
(cmd-window (get-buffer-window cmd-buffer))
- (window (selected-window))
)
(when cmd-buffer
(unless cmd-window
- (setq cmd-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))
+ (setq cmd-window (realgud-prepare-window (selected-window)))
(set-window-buffer cmd-window cmd-buffer)
)
(if switch?
@@ -123,17 +126,10 @@ See also `realgud-window-src'"
(cmd-window (get-buffer-window cmd-buffer))
(bt-buffer (realgud-get-backtrace-buf cmd-buffer))
(bt-window (get-buffer-window bt-buffer))
- (window (selected-window))
)
(when cmd-buffer
(unless bt-window
- (setq bt-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))
+ (setq bt-window (realgud-prepare-window (selected-window)))
(set-window-buffer bt-window bt-buffer)
)
(if switch?
@@ -157,17 +153,10 @@ See also `realgud-window-src'"
(cmd-window (get-buffer-window cmd-buffer))
(brkpt-buffer (realgud-get-breakpoint-buf cmd-buffer))
(brkpt-window (get-buffer-window brkpt-buffer))
- (window (selected-window))
)
(when cmd-buffer
(unless brkpt-window
- (setq brkpt-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))
+ (setq brkpt-window (realgud-prepare-window (selected-window)))
(set-window-buffer brkpt-window brkpt-buffer)
)
(if switch?
@@ -191,17 +180,10 @@ See also `realgud-window-src'"
(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))
+ (setq locals-window (realgud-prepare-window (selected-window)))
(set-window-buffer locals-window locals-buffer)
)
(if switch?
- [elpa] externals/realgud 9814710 25/72: Travis has changed - attempted fix #7, (continued)
- [elpa] externals/realgud 9814710 25/72: Travis has changed - attempted fix #7, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 94f2835 31/72: Just another remake test, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 51f55ce 35/72: Try to fix travisCI, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 1238d8e 37/72: Fix bug when invalid debugger name ..., Stefan Monnier, 2021/03/26
- [elpa] externals/realgud e03446f 36/72: Merge pull request #265 from realgud/feature/comint-truncate-buffer, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 31a99d3 42/72: debbugers: Fix duplicate require-relative-list for ../../common/run., Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 24c02f0 43/72: Merge pull request #272 from Apteryks/fix-unbound-realgud-run-process, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 96dada0 47/72: fix buffer type detection for locals., Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 48c2562 54/72: Fix compilation error., Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 1cc5ddc 59/72: add ability to show all locals in one command, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 4a9c658 62/72: Add option to control orientation when splitting window.,
Stefan Monnier <=
- [elpa] externals/realgud 5abc55c 63/72: Merge pull request #285 from yangyingchao/feature/split-orientation, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 66f22b9 64/72: Avoid running y-n-prompt from inside minubuffer..., Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 5d83013 65/72: Add proper cleanup for locals. Fix broken logic from b5ee91c., Stefan Monnier, 2021/03/26
- [elpa] externals/realgud a92335e 67/72: trepan2/3k re prompts & locals require..., Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 4e4d1d2 70/72: fix issue: failed to load file buffer/locals., Stefan Monnier, 2021/03/26
- [elpa] externals/realgud ff66001 71/72: Merge pull request #288 from yangyingchao/hotfix_failed_to_load_helper, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud b5ee91c 51/72: Introduce realgud-update-hook and add locals auto-refresh, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 42bb9af 53/72: Remove circular-causing require, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud bd1942e 60/72: Use list of variables as ID for frames, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud f73c039 72/72: trepan2-loc-fn-callback allow for optional callback, Stefan Monnier, 2021/03/26