This repository has been archived by the owner on Nov 15, 2021. It is now read-only.
forked from mark-moseley/ruby-debug
-
Notifications
You must be signed in to change notification settings - Fork 80
/
rdebug-layouts.el
180 lines (154 loc) · 6.38 KB
/
rdebug-layouts.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
;;; rdebug-layouts.el --- Ruby debugger window layouts.
;; Copyright (C) 2008 Rocky Bernstein (rocky@gnu.org)
;; Copyright (C) 2008 Anders Lindgren
;; $Id: rdebug-layouts.el 723 2008-02-24 04:51:39Z rockyb $
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;; Commentary:
;; This is file contains the window layouts that come with rdebug; the
;; code where can be consulted as a guide for creating other window
;; layouts.
;; See the manual and the file `rdebug.el' for overall information on
;; the ruby debugger rdebug.
;;; Code:
(defun rdebug-get-buffer (name script-name)
"Return a rdebug buffer for displaying NAME when debugging SCRIPT-NAME.
If the buffer doesn't exists it is created."
(get-buffer-create (format "*rdebug-%s-%s*" name script-name)))
(defun rdebug-get-existing-buffer (name script-name)
"Return a rdebug buffer for displaying NAME when debugging SCRIPT-NAME.
Return nil if the buffer doesn't exists."
(get-buffer (format "*rdebug-%s-%s*" name script-name)))
(defun rdebug-window-layout-conservative (src-buf name)
"A conservative rdebug window layout with three windows.
This window layout mimics the traditional debugger shell and
source window layout, it only add one secondary window.
Initially, the secondary window displays output of the debugged
process, but any secondary buffer can be displayed, press `?' in
the window for more details.
Argument SRC-BUF the buffer containing the Ruby source program that was initially run. NAME is the name of that buffer."
(delete-other-windows)
(split-window-horizontally)
(other-window 1)
(switch-to-buffer src-buf)
(other-window 1)
(when rdebug-use-separate-io-buffer
(split-window nil 20)
(set-window-buffer
(selected-window) (rdebug-get-buffer "output" name)))
(other-window 1))
(defun rdebug-window-layout-rocky (src-buf name)
"Rocky's window layout.
3 windows. The source window is on top 4/5 of height. The
bottom is split between the command windows and a stack window.
See `rdebug' for more information.
Argument SRC-BUF the buffer containing the Ruby source program that was initially run. NAME is the name of that buffer."
(delete-other-windows)
(split-window nil ( / ( * (window-height) 4) 5))
(set-window-buffer
(selected-window) src-buf)
(other-window 1)
(set-window-buffer
(selected-window) (rdebug-get-buffer "frame" name))
(split-window-horizontally)
(set-window-buffer
(selected-window) (rdebug-get-buffer "cmd" name))
(goto-char (point-max)))
(defun rdebug-window-layout-rocky2 (src-buf name)
"This layout is standard window without the output window, see `rdebug'.
for more information.
Argument SRC-BUF is the NAME of the buffer containing the Ruby source program that was initially run."
(delete-other-windows)
(split-window nil ( / ( * (window-height) 3) 4))
(set-window-buffer
(selected-window) src-buf)
(split-window nil ( / (window-height) 3))
(split-window-horizontally)
(set-window-buffer
(selected-window) (rdebug-get-buffer "frame" name))
(other-window 1)
(set-window-buffer
(selected-window) (rdebug-get-buffer "variables" name))
(other-window 1)
(switch-to-buffer src-buf)
(other-window 1)
(set-window-buffer
(selected-window) (rdebug-get-buffer "cmd" name))
(goto-char (point-max)))
(defun rdebug-window-layout-stack-of-windows (src-buf name)
"A rdebug window layout with several secondary windows to the right.
The debugger shell and the source code window is to the left.
Argument SRC-BUF the buffer containing the Ruby source program that was initially run. NAME is the name of that buffer."
(delete-other-windows)
(split-window-horizontally)
(split-window nil 20)
(set-window-buffer
(selected-window) (rdebug-get-buffer "cmd" name))
(other-window 1)
(switch-to-buffer src-buf)
(other-window 1)
(split-window)
(split-window)
(set-window-buffer
(selected-window) (rdebug-get-buffer "variables" name))
(other-window 1)
(set-window-buffer
(selected-window) (rdebug-get-buffer "frame" name))
(when rdebug-use-separate-io-buffer
(other-window 1)
(split-window)
(set-window-buffer
(selected-window) (rdebug-get-buffer "output" name)))
(other-window 1)
(set-window-buffer
(selected-window) (rdebug-get-buffer "breakpoints" name))
(other-window 1))
;; The default layout
(defun rdebug-window-layout-standard (src-buf name)
"The default rdebug window layout, see `rdebug' for more information.
Argument SRC-BUF the buffer containing the Ruby source program that was initially run. NAME is the name of that buffer."
(delete-other-windows)
(split-window nil ( / ( * (window-height) 3) 4))
(split-window nil ( / (window-height) 3))
(split-window-horizontally)
(other-window 1)
(set-window-buffer
(selected-window) (rdebug-get-buffer "variables" name))
(other-window 1)
(switch-to-buffer src-buf)
(when rdebug-use-separate-io-buffer
(split-window-horizontally)
(other-window 1)
(set-window-buffer
(selected-window) (rdebug-get-buffer "output" name)))
(other-window 1)
(set-window-buffer
(selected-window) (rdebug-get-buffer "frame" name))
(split-window-horizontally)
(other-window 1)
(set-window-buffer
(selected-window) (rdebug-get-buffer "breakpoints" name))
(other-window 1)
(goto-char (point-max)))
(defun rdebug-window-layout-no-shell (src-buf name)
"A rdebug window layout without a shell window.
Argument SRC-BUF the buffer containing the Ruby source program that was initially run. NAME is the name of that buffer."
(delete-other-windows)
(set-window-buffer
(selected-window) (rdebug-get-buffer "watch" name))
(rdebug-window-layout-standard src-buf name))
(provide 'rdebug-layouts)
;;; Local variables:
;;; eval:(put 'rdebug-debug-enter 'lisp-indent-hook 1)
;;; End:
;;; rdebug-layouts.el ends here