~ubuntu-branches/debian/lenny/ecb/lenny

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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<html lang="en">
<head>
<title>ECB - the Emacs Code Browser</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name=description content="ECB - the Emacs Code Browser">
<meta name=generator content="makeinfo 4.2">
<link href="http://www.gnu.org/software/texinfo/" rel=generator-home>
</head>
<body>
<p>
Node:<a name="The%20other%20window">The other window</a>,
Next:<a rel=next accesskey=n href="The-Methods-buffer.html#The%20Methods%20buffer">The Methods buffer</a>,
Previous:<a rel=previous accesskey=p href="Temp--and-compile-buffers.html#Temp-%20and%20compile-buffers">Temp- and compile-buffers</a>,
Up:<a rel=up accesskey=u href="Usage-of-ECB.html#Usage%20of%20ECB">Usage of ECB</a>
<hr><br>

<h3>How the "other window" is determined by ECB</h3>

<p>Normally all windows in an Emacs-frame are arranged in a cyclic order
and window-selecting-commands like <code>other-window</code> or
window-scrolling-commands like <code>scroll-other-window</code> choose
simply the next<a rel=footnote href="#fn-1"><sup>1</sup></a> window after the current window as
"other window".

<h4>"Other window"-basics in ECB</h4>

<p>With a typical window-layout of ECB such a cyclic order of
<strong>all</strong> windows in the ECB-frame does not make sense because it
would be not very intuitive and against that what the user wants to
"say" when calling <code>other-window</code> or
<code>scroll-other-window</code>.

<p>Therefore ECB divides the whole set of windows of the ECB-frame in
several subsets:

<ul>
<li>The edit-windows of the edit-area
<li>The special tree-windows for browsing-tasks
<li>The compile-window at the bottom (if there is one)
<li>The minibuffer-window of the ECB-frame (if active)
</ul>

<p>Each of these subsets will be treated as a cyclic ordered subset, i.e. 
all windows in each of these subsets are ordered as the function
<code>walk-windows</code> would visit the windows when the windows of a
subset would be the only windows of a
frame<a rel=footnote href="#fn-2"><sup>2</sup></a>.

<h4>Builtin "other window" behaviors of ECB</h4>

<p>ECB now offers to specify the behavior of commands like
<code>other-window</code> or <code>scroll-other-window</code> within the
ECB-frame. This can be done with the option
<code>ecb-other-window-behavior</code>. This option offers several builtin
behaviors:

<ul>
<li>All windows of the ECB-frame are considered

<p>ECB will cycle through all windows of the ECB-frame or scroll simply
the next window in the ECB-frame, means it behaves like the original
<code>other-window</code> rsp. the original
<code>other-window-for-scrolling</code>.

</p><li>Only the windows of the edit-area are considered

<p>ECB will only cycle through the edit-windows of ECB or only scroll
another edit-window. If the selected window is not an edit-window then
all windows are taken into account.

</p><li>The edit-windos and the compile-window are considered

<p>Like above but the compile-window will be added to the subset of the
edit-windows.

</p><li>Behave as smart and intuitive as possible

<p>This is the default behavior of ECB. ECB tries to choose the
<code>other-window</code>-destination or the "other window" to scroll in a
smart and intuitive way: If point is in one of the edit-windows and if
the edit-area is splitted then always the "next" edit-window is
choosen (whereas the next edit-window of the last edit-window is the
first edit-window)- if the edit-area is unsplitted then the
compile-window is used if there is one. In the context of an
<code>other-window</code>-call the <var>ARG</var> of <code>other-window</code> will be
taken into account.

<p>If one of the special ecb-windows is selected then always the "next"
ecb-window is choosen (whereas the next ecb-window of the last
ecb-window is the first ecb-window). In the context of an
<code>other-window</code>-call the <var>ARG</var> of <code>other-window</code> will be
taken into account.

<p>If the compile-window is selected then always the last edit-window
which had the point will be used unless <code>other-window</code> has been
called with a prefix-argument unequal 1. 
</ul>

<p>Regardless of the different behaviors above ECB handles the situation
of an active minibuffer during a call to <code>other-window</code> or
<code>scroll-other-window</code> like follows:

<p>If the minibuffer-window is selected then ECB always chooses the
window <code>minibuffer-scroll-window</code> points to (when this variable
is set, otherwise the compile-window or the last selected edit-window
is choosen) when the called command is called to choose the 1. next
window (always true for scrolling another window or true when
<code>other-window</code> called without prefix-arg or with prefix-arg equal
1). Otherwise the window ARG steps away is choosen (in case of
<code>other-window</code>).

<p>If there is an active minibuffer but the minibuffer-window is not
selected then <code>other-window</code> and <code>scroll-other-window</code>
behave like the original version.

<h4>User-defined "other window" behavior</h4>

<p>In addition to the builtin "other window" behaviors ECB offers a
user to completely define for himself how ECB should choose another
window for scrolling it or selecting it. This can be done with the
option <code>ecb-other-window-behavior</code> too because this option can
also have a function-symbol as value:

<p>Such a function gets seven arguments:
<ol type=1 start=1>
</p><li>A canonical list of all currently visible windows of the
<code>ecb-frame</code>
<li>A canonical list of all currently visible edit-windows
<li>A canonical list of all currently visible ecb-windows
<li>The window-object of the compile-window if there is any. 
<li>The minibuffer-window of the ECB-frame if there is an active
minibuffer. 
<li>The result of the function <code>ecb-where-is-point</code> - see the
documentation of this function for details. 
<li>An integer which indicates how many steps away from the current
selected window the "other-window" is. Is nil when this function is
called in another context then for <code>other-window</code>.
</ol>

<p>The function has to return a window-object which is then used as
"other window" for the command <code>other-window</code> or for scrolling
another window (e.g. with <code>scroll-other-window</code>). Such a function
has to handle properly all situation for itself.

<p>Here is an example for such a function:

<br><pre>(defun ecb-get-other-window-smart (win-list
                                   edit-win-list
                                   ecb-win-list
                                   comp-win
                                   minibuf-win
                                   point-loc
                                   nth-window)
  (if minibuf-win
      ;; if we have an active mini-buffer we delegate this to
      ;; `ecb-get-other-window-minibuf-active'
      (ecb-get-other-window-minibuf-active win-list
                                           edit-win-list
                                           ecb-win-list
                                           comp-win
                                           minibuf-win
                                           point-loc
                                           nth-window)
    ;; here we have no active minibuffer!
    (let* ((nth-win (or nth-window 1))
           (next-listelem-fcn (if (&lt; nth-win 0)
                                  'ecb-prev-listelem
                                'ecb-next-listelem)))
      (cond ((equal point-loc 'ecb)
             (funcall next-listelem-fcn ecb-win-list
                      (selected-window) nth-win))
            ((equal point-loc 'compile)
             (if (= nth-win 1)
                 (or (and ecb-last-edit-window-with-point
                          (window-live-p ecb-last-edit-window-with-point)
                          ecb-last-edit-window-with-point)
                     (car edit-win-list))
               (funcall next-listelem-fcn
                        (append edit-win-list (list (selected-window)))
                        (selected-window)
                        nth-win)))
            (t ;; must be an edit-window
             (funcall next-listelem-fcn
                      (append edit-win-list
                              (if (and comp-win
                                       (= (length edit-win-list) 1))
                                  (list comp-win)))
                      (selected-window)
                      nth-win))))))
</pre>

<p>This example implements the builtin smart behavior described above.

<hr><h4>Footnotes</h4>
<ol type="1">
<li><a name="fn-1"></a>
<p><code>other-window</code> allows to select ARG'th
different window, i.e. the window ARG steps away from current window
in the cyclic order of the windows</p>

<li><a name="fn-2"></a>
<p><code>other-window</code> uses the same window-ordering as
<code>walk-windows</code></p>

</ol><hr>

</body></html>