aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Rudalics2012-03-11 14:30:30 +0100
committerMartin Rudalics2012-03-11 14:30:30 +0100
commitc491fa419042fa7768fd25db758d2db7f8cf547c (patch)
tree7888c0b6a2bf9b44076c22338fdf5f3a13173cab
parent2b84f674cce046d8155dd8098286800b471f0f4c (diff)
downloademacs-c491fa419042fa7768fd25db758d2db7f8cf547c.tar.gz
emacs-c491fa419042fa7768fd25db758d2db7f8cf547c.zip
In split-window-below fix handling of split-window-keep-point (Bug#10971).
* window.el (split-window-below): Fix bug in case where split-window-keep-point is nil (Bug#10971).
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/window.el39
2 files changed, 27 insertions, 17 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 56ebb5fc948..50e012ad77b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12012-03-11 Martin Rudalics <rudalics@gmx.at>
2
3 * window.el (split-window-below): Fix bug in case where
4 split-window-keep-point is nil (Bug#10971).
5
12012-03-11 Juri Linkov <juri@jurta.org> 62012-03-11 Juri Linkov <juri@jurta.org>
2 7
3 * replace.el (replace-highlight): Set isearch-word to nil 8 * replace.el (replace-highlight): Set isearch-word to nil
diff --git a/lisp/window.el b/lisp/window.el
index edd8a113876..f79041e0e6c 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -3273,7 +3273,7 @@ Otherwise, the window starts are chosen so as to minimize the
3273amount of redisplay; this is convenient on slow terminals." 3273amount of redisplay; this is convenient on slow terminals."
3274 (interactive "P") 3274 (interactive "P")
3275 (let ((old-window (selected-window)) 3275 (let ((old-window (selected-window))
3276 (old-point (point)) 3276 (old-point (window-point-1))
3277 (size (and size (prefix-numeric-value size))) 3277 (size (and size (prefix-numeric-value size)))
3278 moved-by-window-height moved new-window bottom) 3278 moved-by-window-height moved new-window bottom)
3279 (when (and size (< size 0) (< (- size) window-min-height)) 3279 (when (and size (< size 0) (< (- size) window-min-height))
@@ -3282,22 +3282,27 @@ amount of redisplay; this is convenient on slow terminals."
3282 (setq new-window (split-window nil size)) 3282 (setq new-window (split-window nil size))
3283 (unless split-window-keep-point 3283 (unless split-window-keep-point
3284 (with-current-buffer (window-buffer) 3284 (with-current-buffer (window-buffer)
3285 (goto-char (window-start)) 3285 ;; Use `save-excursion' around vertical movements below
3286 (setq moved (vertical-motion (window-height))) 3286 ;; (Bug#10971). Note: When the selected window's buffer has a
3287 (set-window-start new-window (point)) 3287 ;; header line, up to two lines of the buffer may not show up
3288 (when (> (point) (window-point new-window)) 3288 ;; in the resulting configuration.
3289 (set-window-point new-window (point))) 3289 (save-excursion
3290 (when (= moved (window-height)) 3290 (goto-char (window-start))
3291 (setq moved-by-window-height t) 3291 (setq moved (vertical-motion (window-height)))
3292 (vertical-motion -1)) 3292 (set-window-start new-window (point))
3293 (setq bottom (point))) 3293 (when (> (point) (window-point new-window))
3294 (and moved-by-window-height 3294 (set-window-point new-window (point)))
3295 (<= bottom (point)) 3295 (when (= moved (window-height))
3296 (set-window-point old-window (1- bottom))) 3296 (setq moved-by-window-height t)
3297 (and moved-by-window-height 3297 (vertical-motion -1))
3298 (<= (window-start new-window) old-point) 3298 (setq bottom (point)))
3299 (set-window-point new-window old-point) 3299 (and moved-by-window-height
3300 (select-window new-window))) 3300 (<= bottom (point))
3301 (set-window-point-1 old-window (1- bottom)))
3302 (and moved-by-window-height
3303 (<= (window-start new-window) old-point)
3304 (set-window-point new-window old-point)
3305 (select-window new-window))))
3301 ;; Always copy quit-restore parameter in interactive use. 3306 ;; Always copy quit-restore parameter in interactive use.
3302 (let ((quit-restore (window-parameter old-window 'quit-restore))) 3307 (let ((quit-restore (window-parameter old-window 'quit-restore)))
3303 (when quit-restore 3308 (when quit-restore