comparison lisp/window.el @ 108:8644955999f0

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Mon, 22 Oct 1990 03:36:55 +0000
parents 9697c13298e5
children b6465a2ae3e5
comparison
equal deleted inserted replaced
107:0676c0c9346f 108:8644955999f0
41 (enlarge-window (- size (window-height))))) 41 (enlarge-window (- size (window-height)))))
42 'nomini)))) 42 'nomini))))
43 43
44 (defun split-window-vertically (&optional arg) 44 (defun split-window-vertically (&optional arg)
45 "Split current window into two windows, one above the other. 45 "Split current window into two windows, one above the other.
46 This window becomes the uppermost of the two, and gets 46 The uppermost window gets ARG lines and the other gets the rest.
47 ARG lines. No arg means split equally." 47 With no argument, split equally or close to it.
48 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
52 The value of point can change if the text around point
53 is hidden by the new mode line."
48 (interactive "P") 54 (interactive "P")
49 (let ((old-w (selected-window)) 55 (let ((old-w (selected-window))
50 new-w bottom) 56 (old-point (point))
57 new-w bottom switch)
51 (setq new-w (split-window nil (and arg (prefix-numeric-value arg)))) 58 (setq new-w (split-window nil (and arg (prefix-numeric-value arg))))
52 (save-excursion 59 (save-excursion
53 (set-buffer (window-buffer)) 60 (set-buffer (window-buffer))
54 (goto-char (window-start)) 61 (goto-char (window-start))
55 (vertical-motion (window-height)) 62 (vertical-motion (window-height))
57 (if (> (point) (window-point new-w)) 64 (if (> (point) (window-point new-w))
58 (set-window-point new-w (point))) 65 (set-window-point new-w (point)))
59 (vertical-motion -1) 66 (vertical-motion -1)
60 (setq bottom (point))) 67 (setq bottom (point)))
61 (if (<= bottom (point)) 68 (if (<= bottom (point))
62 (set-window-point old-w (1- bottom))))) 69 (set-window-point old-w (1- bottom)))
70 (if (< (window-start new-w) old-point)
71 (progn
72 (set-window-point new-w old-point)
73 (select-window new-w)))))
63 74
64 (defun split-window-horizontally (&optional arg) 75 (defun split-window-horizontally (&optional arg)
65 "Split current window into two windows side by side. 76 "Split current window into two windows side by side.
66 This window becomes the leftmost of the two, and gets 77 This window becomes the leftmost of the two, and gets
67 ARG columns. No arg means split equally." 78 ARG columns. No arg means split equally."