Commit 4464514e authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(split-window-vertically): Don't change point in old

window if both the original point and the end of the buffer are
visible after splitting, when split-window-keep-point is nil.
parent b39da8b1
...@@ -167,7 +167,8 @@ new mode line." ...@@ -167,7 +167,8 @@ new mode line."
(let ((old-w (selected-window)) (let ((old-w (selected-window))
(old-point (point)) (old-point (point))
(size (and arg (prefix-numeric-value arg))) (size (and arg (prefix-numeric-value arg)))
new-w bottom switch) (window-full-p nil)
new-w bottom switch moved)
(and size (< size 0) (setq size (+ (window-height) size))) (and size (< size 0) (setq size (+ (window-height) size)))
(setq new-w (split-window nil size)) (setq new-w (split-window nil size))
(or split-window-keep-point (or split-window-keep-point
...@@ -175,18 +176,23 @@ new mode line." ...@@ -175,18 +176,23 @@ new mode line."
(save-excursion (save-excursion
(set-buffer (window-buffer)) (set-buffer (window-buffer))
(goto-char (window-start)) (goto-char (window-start))
(vertical-motion (window-height)) (setq moved (vertical-motion (window-height)))
(set-window-start new-w (point)) (set-window-start new-w (point))
(if (> (point) (window-point new-w)) (if (> (point) (window-point new-w))
(set-window-point new-w (point))) (set-window-point new-w (point)))
(vertical-motion -1) (and (= moved (window-height))
(setq bottom (point))) (progn
(if (<= bottom (point)) (setq window-full-p t)
(set-window-point old-w (1- bottom))) (vertical-motion -1)))
(if (< (window-start new-w) old-point) (setq bottom (point)))
(progn (and window-full-p
(set-window-point new-w old-point) (<= bottom (point))
(select-window new-w))))) (set-window-point old-w (1- bottom)))
(and window-full-p
(<= (window-start new-w) old-point)
(set-window-point new-w old-point)
(select-window new-w)))))
new-w)) new-w))
(defun split-window-horizontally (&optional arg) (defun split-window-horizontally (&optional arg)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment