comparison lisp/window.el @ 382:b6465a2ae3e5

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Mon, 12 Aug 1991 07:39:06 +0000
parents 8644955999f0
children 4fa4f423f981
comparison
equal deleted inserted replaced
381:0673e72f6c8c 382:b6465a2ae3e5
39 (walk-windows (function (lambda (w) 39 (walk-windows (function (lambda (w)
40 (select-window w) 40 (select-window w)
41 (enlarge-window (- size (window-height))))) 41 (enlarge-window (- size (window-height)))))
42 'nomini)))) 42 'nomini))))
43 43
44 ;;; Many people find the minimal-redisplay window splitting annoying,
45 ;;; so we make it an option.
46
47 (defvar split-window-keep-point nil
48 "*If non-nil, split windows so that both windows keep the original
49 value of point. This is often more convenient for editing.
50 If nil, split windows to minimize redisplay. This is convenient on
51 slow terminals, but point may be moved strangely to accommodate the
52 redisplay.")
53
44 (defun split-window-vertically (&optional arg) 54 (defun split-window-vertically (&optional arg)
45 "Split current window into two windows, one above the other. 55 "Split current window into two windows, one above the other.
46 The uppermost window gets ARG lines and the other gets the rest. 56 The uppermost window gets ARG lines and the other gets the rest.
47 With no argument, split equally or close to it. 57 With no argument, split equally or close to it.
48 Both windows display the same buffer now current. 58 Both windows display the same buffer now current.
49 The new selected window is the one that the current value of point
50 appears in.
51 59
52 The value of point can change if the text around point 60 If the variable split-window-keep-point is non-nil, both new windows
53 is hidden by the new mode line." 61 will get the same value of point as the current window. This is often
62 more convenient for editing.
63
64 Otherwise, we chose window starts so as to minimize the amount of
65 redisplay; this is convenient on slow terminals. The new selected
66 window is the one that the current value of point appears in. The
67 value of point can change if the text around point is hidden by the
68 new mode line."
54 (interactive "P") 69 (interactive "P")
55 (let ((old-w (selected-window)) 70 (let ((old-w (selected-window))
56 (old-point (point)) 71 (old-point (point))
57 new-w bottom switch) 72 new-w bottom switch)
58 (setq new-w (split-window nil (and arg (prefix-numeric-value arg)))) 73 (setq new-w (split-window nil (and arg (prefix-numeric-value arg))))
59 (save-excursion 74 (if (not split-window-keep-point)
60 (set-buffer (window-buffer))
61 (goto-char (window-start))
62 (vertical-motion (window-height))
63 (set-window-start new-w (point))
64 (if (> (point) (window-point new-w))
65 (set-window-point new-w (point)))
66 (vertical-motion -1)
67 (setq bottom (point)))
68 (if (<= bottom (point))
69 (set-window-point old-w (1- bottom)))
70 (if (< (window-start new-w) old-point)
71 (progn 75 (progn
72 (set-window-point new-w old-point) 76 (save-excursion
73 (select-window new-w))))) 77 (set-buffer (window-buffer))
78 (goto-char (window-start))
79 (vertical-motion (window-height))
80 (set-window-start new-w (point))
81 (if (> (point) (window-point new-w))
82 (set-window-point new-w (point)))
83 (vertical-motion -1)
84 (setq bottom (point)))
85 (if (<= bottom (point))
86 (set-window-point old-w (1- bottom)))
87 (if (< (window-start new-w) old-point)
88 (progn
89 (set-window-point new-w old-point)
90 (select-window new-w)))))))
74 91
75 (defun split-window-horizontally (&optional arg) 92 (defun split-window-horizontally (&optional arg)
76 "Split current window into two windows side by side. 93 "Split current window into two windows side by side.
77 This window becomes the leftmost of the two, and gets 94 This window becomes the leftmost of the two, and gets
78 ARG columns. No arg means split equally." 95 ARG columns. No arg means split equally."