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).
This commit is contained in:
parent
2b84f674cc
commit
c491fa4190
2 changed files with 27 additions and 17 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2012-03-11 Martin Rudalics <rudalics@gmx.at>
|
||||||
|
|
||||||
|
* window.el (split-window-below): Fix bug in case where
|
||||||
|
split-window-keep-point is nil (Bug#10971).
|
||||||
|
|
||||||
2012-03-11 Juri Linkov <juri@jurta.org>
|
2012-03-11 Juri Linkov <juri@jurta.org>
|
||||||
|
|
||||||
* replace.el (replace-highlight): Set isearch-word to nil
|
* replace.el (replace-highlight): Set isearch-word to nil
|
||||||
|
|
|
@ -3273,7 +3273,7 @@ Otherwise, the window starts are chosen so as to minimize the
|
||||||
amount of redisplay; this is convenient on slow terminals."
|
amount of redisplay; this is convenient on slow terminals."
|
||||||
(interactive "P")
|
(interactive "P")
|
||||||
(let ((old-window (selected-window))
|
(let ((old-window (selected-window))
|
||||||
(old-point (point))
|
(old-point (window-point-1))
|
||||||
(size (and size (prefix-numeric-value size)))
|
(size (and size (prefix-numeric-value size)))
|
||||||
moved-by-window-height moved new-window bottom)
|
moved-by-window-height moved new-window bottom)
|
||||||
(when (and size (< size 0) (< (- size) window-min-height))
|
(when (and size (< size 0) (< (- size) window-min-height))
|
||||||
|
@ -3282,22 +3282,27 @@ amount of redisplay; this is convenient on slow terminals."
|
||||||
(setq new-window (split-window nil size))
|
(setq new-window (split-window nil size))
|
||||||
(unless split-window-keep-point
|
(unless split-window-keep-point
|
||||||
(with-current-buffer (window-buffer)
|
(with-current-buffer (window-buffer)
|
||||||
(goto-char (window-start))
|
;; Use `save-excursion' around vertical movements below
|
||||||
(setq moved (vertical-motion (window-height)))
|
;; (Bug#10971). Note: When the selected window's buffer has a
|
||||||
(set-window-start new-window (point))
|
;; header line, up to two lines of the buffer may not show up
|
||||||
(when (> (point) (window-point new-window))
|
;; in the resulting configuration.
|
||||||
(set-window-point new-window (point)))
|
(save-excursion
|
||||||
(when (= moved (window-height))
|
(goto-char (window-start))
|
||||||
(setq moved-by-window-height t)
|
(setq moved (vertical-motion (window-height)))
|
||||||
(vertical-motion -1))
|
(set-window-start new-window (point))
|
||||||
(setq bottom (point)))
|
(when (> (point) (window-point new-window))
|
||||||
(and moved-by-window-height
|
(set-window-point new-window (point)))
|
||||||
(<= bottom (point))
|
(when (= moved (window-height))
|
||||||
(set-window-point old-window (1- bottom)))
|
(setq moved-by-window-height t)
|
||||||
(and moved-by-window-height
|
(vertical-motion -1))
|
||||||
(<= (window-start new-window) old-point)
|
(setq bottom (point)))
|
||||||
(set-window-point new-window old-point)
|
(and moved-by-window-height
|
||||||
(select-window new-window)))
|
(<= bottom (point))
|
||||||
|
(set-window-point-1 old-window (1- bottom)))
|
||||||
|
(and moved-by-window-height
|
||||||
|
(<= (window-start new-window) old-point)
|
||||||
|
(set-window-point new-window old-point)
|
||||||
|
(select-window new-window))))
|
||||||
;; Always copy quit-restore parameter in interactive use.
|
;; Always copy quit-restore parameter in interactive use.
|
||||||
(let ((quit-restore (window-parameter old-window 'quit-restore)))
|
(let ((quit-restore (window-parameter old-window 'quit-restore)))
|
||||||
(when quit-restore
|
(when quit-restore
|
||||||
|
|
Loading…
Add table
Reference in a new issue