3375
13ddc81f0b43
(count-windows): PROC argument of walk-windows takes an argument.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1 ;;; window.el --- GNU Emacs window commands aside from those written in C.
|
773
|
2
|
7300
|
3 ;;; Copyright (C) 1985, 1989, 1992, 1993, 1994 Free Software Foundation, Inc.
|
841
|
4
|
773
|
5 ;; Maintainer: FSF
|
36
|
6
|
|
7 ;; This file is part of GNU Emacs.
|
|
8
|
|
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
|
|
10 ;; it under the terms of the GNU General Public License as published by
|
707
|
11 ;; the Free Software Foundation; either version 2, or (at your option)
|
36
|
12 ;; any later version.
|
|
13
|
|
14 ;; GNU Emacs is distributed in the hope that it will be useful,
|
|
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17 ;; GNU General Public License for more details.
|
|
18
|
|
19 ;; You should have received a copy of the GNU General Public License
|
|
20 ;; along with GNU Emacs; see the file COPYING. If not, write to
|
|
21 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
22
|
773
|
23 ;;; Code:
|
36
|
24
|
11086
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
25 ;;;; Window tree functions.
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
26
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
27 (defun one-window-p (&optional nomini all-frames)
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
28 "Returns non-nil if the selected window is the only window (in its frame).
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
29 Optional arg NOMINI non-nil means don't count the minibuffer
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
30 even if it is active.
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
31
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
32 The optional arg ALL-FRAMES t means count windows on all frames.
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
33 If it is `visible', count windows on all visible frames.
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
34 ALL-FRAMES nil or omitted means count only the selected frame,
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
35 plus the minibuffer it uses (which may be on another frame).
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
36 If ALL-FRAMES is neither nil nor t, count only the selected frame."
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
37 (let ((base-window (selected-window)))
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
38 (if (and nomini (eq base-window (minibuffer-window)))
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
39 (setq base-window (next-window base-window)))
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
40 (eq base-window
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
41 (next-window base-window (if nomini 'arg) all-frames))))
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
42
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
43 (defun walk-windows (proc &optional minibuf all-frames)
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
44 "Cycle through all visible windows, calling PROC for each one.
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
45 PROC is called with a window as argument.
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
46
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
47 Optional second arg MINIBUF t means count the minibuffer window even
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
48 if not active. MINIBUF nil or omitted means count the minibuffer iff
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
49 it is active. MINIBUF neither t nor nil means not to count the
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
50 minibuffer even if it is active.
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
51
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
52 Several frames may share a single minibuffer; if the minibuffer
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
53 counts, all windows on all frames that share that minibuffer count
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
54 too. Therefore, when a separate minibuffer frame is active,
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
55 `walk-windows' includes the windows in the frame from which you
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
56 entered the minibuffer, as well as the minibuffer window. But if the
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
57 minibuffer does not count, only windows from WINDOW's frame count.
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
58
|
11302
|
59 ALL-FRAMES is the optional third argument.
|
|
60 ALL-FRAMES nil or omitted means cycle within the frames as specified above.
|
|
61 ALL-FRAMES = `visible' means include windows on all visible frames.
|
11086
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
62 ALL-FRAMES = 0 means include windows on all visible and iconified frames.
|
11302
|
63 ALL-FRAMES = t means include windows on all frames including invisible frames.
|
11086
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
64 Anything else means restrict to WINDOW's frame."
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
65 ;; If we start from the minibuffer window, don't fail to come back to it.
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
66 (if (window-minibuffer-p (selected-window))
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
67 (setq minibuf t))
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
68 (let* ((walk-windows-start (selected-window))
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
69 (walk-windows-current walk-windows-start))
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
70 (while (progn
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
71 (setq walk-windows-current
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
72 (next-window walk-windows-current minibuf all-frames))
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
73 (funcall proc walk-windows-current)
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
74 (not (eq walk-windows-current walk-windows-start))))))
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
75
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
76 (defun minibuffer-window-active-p (window)
|
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
77 "Return t if WINDOW (a minibuffer window) is now active."
|
11149
|
78 (eq window (active-minibuffer-window)))
|
12184
|
79
|
|
80 (defmacro save-selected-window (&rest body)
|
|
81 "Execute BODY, then select the window that was selected before BODY."
|
|
82 (list 'let
|
|
83 '((save-selected-window-window (selected-window)))
|
|
84 (list 'unwind-protect
|
|
85 (cons 'progn body)
|
|
86 (list 'select-window 'save-selected-window-window))))
|
11086
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
87
|
36
|
88 (defun count-windows (&optional minibuf)
|
|
89 "Returns the number of visible windows.
|
|
90 Optional arg NO-MINI non-nil means don't count the minibuffer
|
|
91 even if it is active."
|
|
92 (let ((count 0))
|
3375
13ddc81f0b43
(count-windows): PROC argument of walk-windows takes an argument.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
93 (walk-windows (function (lambda (w)
|
36
|
94 (setq count (+ count 1))))
|
|
95 minibuf)
|
|
96 count))
|
|
97
|
|
98 (defun balance-windows ()
|
3724
|
99 "Makes all visible windows the same height (approximately)."
|
36
|
100 (interactive)
|
3724
|
101 (let ((count -1) levels newsizes size)
|
|
102 ;; Find all the different vpos's at which windows start,
|
|
103 ;; then count them. But ignore levels that differ by only 1.
|
|
104 (save-window-excursion
|
|
105 (let (tops (prev-top -2))
|
|
106 (walk-windows (function (lambda (w)
|
|
107 (setq tops (cons (nth 1 (window-edges w))
|
|
108 tops))))
|
|
109 'nomini)
|
|
110 (setq tops (sort tops '<))
|
|
111 (while tops
|
|
112 (if (> (car tops) (1+ prev-top))
|
|
113 (setq prev-top (car tops)
|
|
114 count (1+ count)))
|
|
115 (setq levels (cons (cons (car tops) count) levels))
|
|
116 (setq tops (cdr tops)))
|
|
117 (setq count (1+ count))))
|
|
118 ;; Subdivide the frame into that many vertical levels.
|
|
119 (setq size (/ (frame-height) count))
|
|
120 (walk-windows (function
|
|
121 (lambda (w)
|
|
122 (select-window w)
|
|
123 (let ((newtop (cdr (assq (nth 1 (window-edges))
|
|
124 levels)))
|
|
125 (newbot (or (cdr (assq (+ (window-height)
|
|
126 (nth 1 (window-edges)))
|
|
127 levels))
|
|
128 count)))
|
|
129 (setq newsizes
|
|
130 (cons (cons w (* size (- newbot newtop)))
|
11029
3f98c129f7bc
(balance-windows): Ignore minibuffer window when browsing the `levels'.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
131 newsizes)))))
|
3f98c129f7bc
(balance-windows): Ignore minibuffer window when browsing the `levels'.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
132 'nomini)
|
36
|
133 (walk-windows (function (lambda (w)
|
3724
|
134 (select-window w)
|
|
135 (let ((newsize (cdr (assq w newsizes))))
|
|
136 (enlarge-window (- newsize
|
|
137 (window-height))))))
|
|
138 'nomini)))
|
11086
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
139
|
698
|
140 ;;; I think this should be the default; I think people will prefer it--rms.
|
|
141 (defvar split-window-keep-point t
|
3724
|
142 "*If non-nil, split windows keeps the original point in both children.
|
|
143 This is often more convenient for editing.
|
|
144 If nil, adjust point in each of the two windows to minimize redisplay.
|
|
145 This is convenient on slow terminals, but point can move strangely.")
|
382
|
146
|
36
|
147 (defun split-window-vertically (&optional arg)
|
|
148 "Split current window into two windows, one above the other.
|
108
|
149 The uppermost window gets ARG lines and the other gets the rest.
|
6670
|
150 Negative arg means select the size of the lowermost window instead.
|
108
|
151 With no argument, split equally or close to it.
|
|
152 Both windows display the same buffer now current.
|
382
|
153
|
|
154 If the variable split-window-keep-point is non-nil, both new windows
|
|
155 will get the same value of point as the current window. This is often
|
|
156 more convenient for editing.
|
108
|
157
|
382
|
158 Otherwise, we chose window starts so as to minimize the amount of
|
|
159 redisplay; this is convenient on slow terminals. The new selected
|
|
160 window is the one that the current value of point appears in. The
|
|
161 value of point can change if the text around point is hidden by the
|
|
162 new mode line."
|
36
|
163 (interactive "P")
|
|
164 (let ((old-w (selected-window))
|
108
|
165 (old-point (point))
|
6670
|
166 (size (and arg (prefix-numeric-value arg)))
|
108
|
167 new-w bottom switch)
|
6670
|
168 (and size (< size 0) (setq size (+ (window-height) size)))
|
|
169 (setq new-w (split-window nil size))
|
419
|
170 (or split-window-keep-point
|
108
|
171 (progn
|
382
|
172 (save-excursion
|
|
173 (set-buffer (window-buffer))
|
|
174 (goto-char (window-start))
|
|
175 (vertical-motion (window-height))
|
|
176 (set-window-start new-w (point))
|
|
177 (if (> (point) (window-point new-w))
|
|
178 (set-window-point new-w (point)))
|
|
179 (vertical-motion -1)
|
|
180 (setq bottom (point)))
|
|
181 (if (<= bottom (point))
|
|
182 (set-window-point old-w (1- bottom)))
|
|
183 (if (< (window-start new-w) old-point)
|
|
184 (progn
|
|
185 (set-window-point new-w old-point)
|
3253
|
186 (select-window new-w)))))
|
|
187 new-w))
|
36
|
188
|
|
189 (defun split-window-horizontally (&optional arg)
|
|
190 "Split current window into two windows side by side.
|
8565
2a2208286955
(split-window-horizontally): If size is negative, measure from the right.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
191 This window becomes the leftmost of the two, and gets ARG columns.
|
2a2208286955
(split-window-horizontally): If size is negative, measure from the right.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
192 Negative arg means select the size of the rightmost window instead.
|
2a2208286955
(split-window-horizontally): If size is negative, measure from the right.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
193 No arg means split equally."
|
36
|
194 (interactive "P")
|
8565
2a2208286955
(split-window-horizontally): If size is negative, measure from the right.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
195 (let ((size (and arg (prefix-numeric-value arg))))
|
2a2208286955
(split-window-horizontally): If size is negative, measure from the right.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
196 (and size (< size 0)
|
2a2208286955
(split-window-horizontally): If size is negative, measure from the right.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
197 (setq size (+ (window-width) size)))
|
2a2208286955
(split-window-horizontally): If size is negative, measure from the right.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
198 (split-window nil size t)))
|
11086
22693a280a42
(one-window-p, walk-windows, minibuffer-window-active-p): Functions moved here.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
199
|
36
|
200 (defun enlarge-window-horizontally (arg)
|
|
201 "Make current window ARG columns wider."
|
|
202 (interactive "p")
|
|
203 (enlarge-window arg t))
|
|
204
|
|
205 (defun shrink-window-horizontally (arg)
|
|
206 "Make current window ARG columns narrower."
|
|
207 (interactive "p")
|
|
208 (shrink-window arg t))
|
|
209
|
2529
bb127c1081af
(shrink-window-if-larger-than-buffer): Moved from electric.el to windows.el,
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
210 (defun shrink-window-if-larger-than-buffer (&optional window)
|
3342
|
211 "Shrink the WINDOW to be as small as possible to display its contents.
|
8721
|
212 Do not shrink to less than `window-min-height' lines.
|
3342
|
213 Do nothing if the buffer contains more lines than the present window height,
|
4364
|
214 or if some of the window's contents are scrolled out of view,
|
6905
|
215 or if the window is not the full width of the frame,
|
4364
|
216 or if the window is the only window of its frame."
|
3342
|
217 (interactive)
|
9007
|
218 (or window (setq window (selected-window)))
|
2529
bb127c1081af
(shrink-window-if-larger-than-buffer): Moved from electric.el to windows.el,
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
219 (save-excursion
|
bb127c1081af
(shrink-window-if-larger-than-buffer): Moved from electric.el to windows.el,
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
220 (set-buffer (window-buffer window))
|
9007
|
221 (let* ((w (selected-window)) ;save-window-excursion can't win
|
|
222 (buffer-file-name buffer-file-name)
|
|
223 (p (point))
|
|
224 (n 0)
|
|
225 (ignore-final-newline
|
|
226 ;; If buffer ends with a newline, ignore it when counting height
|
|
227 ;; unless point is after it.
|
|
228 (and (not (eobp))
|
|
229 (eq ?\n (char-after (1- (point-max))))))
|
|
230 (buffer-read-only nil)
|
|
231 (modified (buffer-modified-p))
|
|
232 (buffer (current-buffer))
|
|
233 (params (frame-parameters (window-frame window)))
|
|
234 (mini (cdr (assq 'minibuffer params)))
|
|
235 (edges (window-edges (selected-window))))
|
|
236 (if (and (< 1 (let ((frame (selected-frame)))
|
|
237 (select-frame (window-frame window))
|
|
238 (unwind-protect
|
|
239 (count-windows)
|
|
240 (select-frame frame))))
|
|
241 (= (window-width window) (frame-width (window-frame window)))
|
6019
0c0b00572d96
(shrink-window-if-larger-than-buffer): Don't shrink if the window that would
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
242 (pos-visible-in-window-p (point-min) window)
|
8778
|
243 (not (eq mini 'only))
|
6019
0c0b00572d96
(shrink-window-if-larger-than-buffer): Don't shrink if the window that would
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
244 (or (not mini)
|
0c0b00572d96
(shrink-window-if-larger-than-buffer): Don't shrink if the window that would
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
245 (< (nth 3 edges)
|
0c0b00572d96
(shrink-window-if-larger-than-buffer): Don't shrink if the window that would
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
246 (nth 1 (window-edges mini)))
|
0c0b00572d96
(shrink-window-if-larger-than-buffer): Don't shrink if the window that would
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
247 (> (nth 1 edges)
|
9007
|
248 (cdr (assq 'menu-bar-lines params)))))
|
3342
|
249 (unwind-protect
|
|
250 (progn
|
|
251 (select-window (or window w))
|
|
252 (goto-char (point-min))
|
4364
|
253 (while (pos-visible-in-window-p
|
|
254 (- (point-max)
|
|
255 (if ignore-final-newline 1 0)))
|
3342
|
256 ;; defeat file locking... don't try this at home, kids!
|
|
257 (setq buffer-file-name nil)
|
|
258 (insert ?\n) (setq n (1+ n)))
|
8672
|
259 (if (> n 0)
|
|
260 (shrink-window (min (1- n)
|
|
261 (- (window-height)
|
|
262 window-min-height)))))
|
3342
|
263 (delete-region (point-min) (point))
|
|
264 (set-buffer-modified-p modified)
|
|
265 (goto-char p)
|
|
266 (select-window w)
|
|
267 ;; Make sure we unbind buffer-read-only
|
|
268 ;; with the proper current buffer.
|
|
269 (set-buffer buffer))))))
|
2529
bb127c1081af
(shrink-window-if-larger-than-buffer): Moved from electric.el to windows.el,
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
270
|
36
|
271 (define-key ctl-x-map "2" 'split-window-vertically)
|
707
|
272 (define-key ctl-x-map "3" 'split-window-horizontally)
|
36
|
273 (define-key ctl-x-map "}" 'enlarge-window-horizontally)
|
|
274 (define-key ctl-x-map "{" 'shrink-window-horizontally)
|
2529
bb127c1081af
(shrink-window-if-larger-than-buffer): Moved from electric.el to windows.el,
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
275 (define-key ctl-x-map "-" 'shrink-window-if-larger-than-buffer)
|
bb127c1081af
(shrink-window-if-larger-than-buffer): Moved from electric.el to windows.el,
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
276 (define-key ctl-x-map "+" 'balance-windows)
|
656
|
277
|
|
278 ;;; windows.el ends here
|