emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r107566: In split-window-below fix ha


From: martin rudalics
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107566: In split-window-below fix handling of split-window-keep-point (Bug#10971).
Date: Sun, 11 Mar 2012 14:30:30 +0100
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107566
committer: martin rudalics <address@hidden>
branch nick: trunk
timestamp: Sun 2012-03-11 14:30:30 +0100
message:
  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).
modified:
  lisp/ChangeLog
  lisp/window.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-03-11 10:27:53 +0000
+++ b/lisp/ChangeLog    2012-03-11 13:30:30 +0000
@@ -1,3 +1,8 @@
+2012-03-11  Martin Rudalics  <address@hidden>
+
+       * window.el (split-window-below): Fix bug in case where
+       split-window-keep-point is nil (Bug#10971).
+
 2012-03-11  Juri Linkov  <address@hidden>
 
        * replace.el (replace-highlight): Set isearch-word to nil

=== modified file 'lisp/window.el'
--- a/lisp/window.el    2012-02-12 05:10:30 +0000
+++ b/lisp/window.el    2012-03-11 13:30:30 +0000
@@ -3273,7 +3273,7 @@
 amount of redisplay; this is convenient on slow terminals."
   (interactive "P")
   (let ((old-window (selected-window))
-       (old-point (point))
+       (old-point (window-point-1))
        (size (and size (prefix-numeric-value size)))
         moved-by-window-height moved new-window bottom)
     (when (and size (< size 0) (< (- size) window-min-height))
@@ -3282,22 +3282,27 @@
     (setq new-window (split-window nil size))
     (unless split-window-keep-point
       (with-current-buffer (window-buffer)
-       (goto-char (window-start))
-       (setq moved (vertical-motion (window-height)))
-       (set-window-start new-window (point))
-       (when (> (point) (window-point new-window))
-         (set-window-point new-window (point)))
-       (when (= moved (window-height))
-         (setq moved-by-window-height t)
-         (vertical-motion -1))
-       (setq bottom (point)))
-      (and moved-by-window-height
-          (<= bottom (point))
-          (set-window-point 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)))
+       ;; Use `save-excursion' around vertical movements below
+       ;; (Bug#10971).  Note: When the selected window's buffer has a
+       ;; header line, up to two lines of the buffer may not show up
+       ;; in the resulting configuration.
+       (save-excursion
+         (goto-char (window-start))
+         (setq moved (vertical-motion (window-height)))
+         (set-window-start new-window (point))
+         (when (> (point) (window-point new-window))
+           (set-window-point new-window (point)))
+         (when (= moved (window-height))
+           (setq moved-by-window-height t)
+           (vertical-motion -1))
+         (setq bottom (point)))
+       (and moved-by-window-height
+            (<= 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.
     (let ((quit-restore (window-parameter old-window 'quit-restore)))
       (when quit-restore


reply via email to

[Prev in Thread] Current Thread [Next in Thread]