emacs-diffs
[Top][All Lists]
Advanced

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

emacs-29 758ac5eabb: Fix split-window-below for the case when split-wind


From: Juri Linkov
Subject: emacs-29 758ac5eabb: Fix split-window-below for the case when split-window-keep-point is nil.
Date: Wed, 18 Jan 2023 13:24:59 -0500 (EST)

branch: emacs-29
commit 758ac5eabbe05fa5244e1bf863e45069035f311c
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    Fix split-window-below for the case when split-window-keep-point is nil.
    
    * lisp/window.el (split-window-below): Don't try to move point when
    split-window-keep-point is nil and window-to-split is not the selected 
window
    or nil (that defaults to the selected window) because code makes sense
    only for the selected window.
    (split-window-below, split-window-right): Improve docstrings (bug#60886)
---
 lisp/window.el | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lisp/window.el b/lisp/window.el
index 4099b70700..84f5c5c3f5 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -5670,7 +5670,8 @@ the original point in both windows."
 
 (defun split-window-below (&optional size window-to-split)
   "Split WINDOW-TO-SPLIT into two windows, one above the other.
-WINDOW-TO-SPLIT is above.  The newly split-off window is
+WINDOW-TO-SPLIT defaults to the selected window and and will be above
+the other window after splitting.  The newly split-off window is
 below and displays the same buffer.  Return the new window.
 
 If optional argument SIZE is omitted or nil, both windows get the
@@ -5691,7 +5692,9 @@ amount of redisplay; this is convenient on slow 
terminals."
       ;; `split-window' would not signal an error here.
       (error "Size of new window too small"))
     (setq new-window (split-window window-to-split size))
-    (unless split-window-keep-point
+    (when (and (null split-window-keep-point)
+               (or (null window-to-split)
+                   (eq window-to-split (selected-window))))
       (with-current-buffer (window-buffer window-to-split)
        ;; Use `save-excursion' around vertical movements below
        ;; (Bug#10971).  Note: When WINDOW-TO-SPLIT's buffer has a
@@ -5732,8 +5735,9 @@ handled as in `split-window-below'."
 
 (defun split-window-right (&optional size window-to-split)
   "Split WINDOW-TO-SPLIT into two side-by-side windows.
-WINDOW-TO-SPLIT is on the left.  The newly split-off window is on
-the right and displays the same buffer.  Return the new window.
+WINDOW-TO-SPLIT defaults to the selected window and and will be on the
+left after splitting.  The newly split-off window is on the right and
+displays the same buffer.  Return the new window.
 
 If optional argument SIZE is omitted or nil, both windows get the
 same width, or close to it.  If SIZE is positive, the left-hand



reply via email to

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