GNU bug report logs - #60886
29.0.60; split-root-window-below broken for split-window-keep-point

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Tue, 17 Jan 2023 17:35:02 UTC

Severity: normal

Tags: patch

Fixed in version 29.0.60

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 60886 in the body.
You can then email your comments to 60886 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#60886; Package emacs. (Tue, 17 Jan 2023 17:35:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> linkov.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 17 Jan 2023 17:35:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.60; split-root-window-below broken for split-window-keep-point
Date: Tue, 17 Jan 2023 19:10:48 +0200
[Message part 1 (text/plain, inline)]
Tags: patch

etc/NEWS:

  *** New commands 'split-root-window-below' and 'split-root-window-right'.
  These commands split the root window in two, and are bound to 'C-x w 2'
  and 'C-x w 3', respectively.

0. emacs -Q
1. (setq split-window-keep-point nil)
2. C-x w 2
3. C-x w 2

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  split-window-below(nil #<window 14>)
  split-root-window-below(nil)
  funcall-interactively(split-root-window-below nil)
  command-execute(split-root-window-below)

[split-window-keep-point.patch (text/x-diff, inline)]
diff --git a/lisp/window.el b/lisp/window.el
index 4099b707009..53d34a3bf6e 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -5670,7 +5675,8 @@ split-window-keep-point
 
 (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 after
+splitting remains above.  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 +5697,9 @@ split-window-below
       ;; `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
+    (unless (or split-window-keep-point
+                ;; `window-buffer' is nil for `frame-root-window'
+                (null (window-buffer window-to-split)))
       (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,7 +5740,8 @@ split-root-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
+WINDOW-TO-SPLIT defaults to the selected window and after
+splitting remains on the left.  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

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60886; Package emacs. (Wed, 18 Jan 2023 13:09:01 GMT) Full text and rfc822 format available.

Message #8 received at 60886 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>, martin rudalics <rudalics <at> gmx.at>
Cc: 60886 <at> debbugs.gnu.org
Subject: Re: bug#60886: 29.0.60;
 split-root-window-below broken for split-window-keep-point
Date: Wed, 18 Jan 2023 15:08:11 +0200
> From: Juri Linkov <juri <at> linkov.net>
> Date: Tue, 17 Jan 2023 19:10:48 +0200
> 
> etc/NEWS:
> 
>   *** New commands 'split-root-window-below' and 'split-root-window-right'.
>   These commands split the root window in two, and are bound to 'C-x w 2'
>   and 'C-x w 3', respectively.
> 
> 0. emacs -Q
> 1. (setq split-window-keep-point nil)
> 2. C-x w 2
> 3. C-x w 2
> 
> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>   split-window-below(nil #<window 14>)
>   split-root-window-below(nil)
>   funcall-interactively(split-root-window-below nil)
>   command-execute(split-root-window-below)
> 
> diff --git a/lisp/window.el b/lisp/window.el
> index 4099b707009..53d34a3bf6e 100644
> --- a/lisp/window.el
> +++ b/lisp/window.el
> @@ -5670,7 +5675,8 @@ split-window-keep-point
>  
>  (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 after
> +splitting remains above.  The newly split-off window is

"Remains" is not a good word here: we are splitting the window in two,
so none of them "remains".  I'd say "...and will be above the other
window after splitting".

>  (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
> +WINDOW-TO-SPLIT defaults to the selected window and after
> +splitting remains on the left.  The newly split-off window is on
>  the right and displays the same buffer.  Return the new window.

Same here.

Martin, any comments?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60886; Package emacs. (Wed, 18 Jan 2023 17:14:01 GMT) Full text and rfc822 format available.

Message #11 received at 60886 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>, Juri Linkov <juri <at> linkov.net>
Cc: 60886 <at> debbugs.gnu.org
Subject: Re: bug#60886: 29.0.60; split-root-window-below broken for
 split-window-keep-point
Date: Wed, 18 Jan 2023 18:13:34 +0100
> Martin, any comments?

'split-window-below' in its present form doesn't make sense when
WINDOW-TO-SPLIT is life but is not the selected window.  It calls
'window-point', 'window-start', 'window-height', ... without an argument
- which means to implicitly use the selected window as argument instead
of WINDOW-TO-SPLIT.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60886; Package emacs. (Wed, 18 Jan 2023 17:33:02 GMT) Full text and rfc822 format available.

Message #14 received at 60886 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>, Juri Linkov <juri <at> linkov.net>
Cc: 60886 <at> debbugs.gnu.org
Subject: Re: bug#60886: 29.0.60; split-root-window-below broken for
 split-window-keep-point
Date: Wed, 18 Jan 2023 18:32:15 +0100
> WINDOW-TO-SPLIT is life but is not the selected window.  It calls
                    _live_ was meant here

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60886; Package emacs. (Wed, 18 Jan 2023 18:26:02 GMT) Full text and rfc822 format available.

Message #17 received at 60886 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 60886 <at> debbugs.gnu.org
Subject: Re: bug#60886: 29.0.60; split-root-window-below broken for
 split-window-keep-point
Date: Wed, 18 Jan 2023 20:25:20 +0200
close 60886 29.0.60
thanks

> 'split-window-below' in its present form doesn't make sense when
> WINDOW-TO-SPLIT is life but is not the selected window.  It calls
> 'window-point', 'window-start', 'window-height', ... without an argument
> - which means to implicitly use the selected window as argument instead
> of WINDOW-TO-SPLIT.

Thanks for mentioning this problem.  Now fixed in the commit 758ac5eabbe.




bug marked as fixed in version 29.0.60, send any further explanations to 60886 <at> debbugs.gnu.org and Juri Linkov <juri <at> linkov.net> Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Wed, 18 Jan 2023 18:26:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60886; Package emacs. (Wed, 18 Jan 2023 23:04:01 GMT) Full text and rfc822 format available.

Message #22 received at 60886 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> linkov.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 60886 <at> debbugs.gnu.org
Subject: Re: bug#60886: 29.0.60; split-root-window-below broken for
 split-window-keep-point
Date: Thu, 19 Jan 2023 00:03:12 +0100
> Thanks for mentioning this problem.  Now fixed in the commit 758ac5eabbe.

> +the other window after splitting.  The newly split-off window is
>  below and displays the same buffer.  Return the new window.

> +left after splitting.  The newly split-off window is on the right and
> +displays the same buffer.  Return the new window.

What is the "same buffer" when the root window is internal in
split-root-window-right/-below?

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60886; Package emacs. (Thu, 19 Jan 2023 06:35:01 GMT) Full text and rfc822 format available.

Message #25 received at 60886 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 60886 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#60886: 29.0.60; split-root-window-below broken for
 split-window-keep-point
Date: Thu, 19 Jan 2023 08:34:24 +0200
> Date: Thu, 19 Jan 2023 00:03:12 +0100
> Cc: Eli Zaretskii <eliz <at> gnu.org>, 60886 <at> debbugs.gnu.org
> From: martin rudalics <rudalics <at> gmx.at>
> 
>  > Thanks for mentioning this problem.  Now fixed in the commit 758ac5eabbe.
> 
>  > +the other window after splitting.  The newly split-off window is
>  >  below and displays the same buffer.  Return the new window.
> 
>  > +left after splitting.  The newly split-off window is on the right and
>  > +displays the same buffer.  Return the new window.
> 
> What is the "same buffer" when the root window is internal in
> split-root-window-right/-below?

I guess "the same buffer as the window which was split"?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60886; Package emacs. (Thu, 19 Jan 2023 08:50:02 GMT) Full text and rfc822 format available.

Message #28 received at 60886 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 60886 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#60886: 29.0.60; split-root-window-below broken for
 split-window-keep-point
Date: Thu, 19 Jan 2023 09:49:06 +0100
>> What is the "same buffer" when the root window is internal in
>> split-root-window-right/-below?
>
> I guess "the same buffer as the window which was split"?

In the case sketched above the window which was split had no buffer.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60886; Package emacs. (Thu, 19 Jan 2023 10:06:01 GMT) Full text and rfc822 format available.

Message #31 received at 60886 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 60886 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#60886: 29.0.60; split-root-window-below broken for
 split-window-keep-point
Date: Thu, 19 Jan 2023 12:05:48 +0200
> Date: Thu, 19 Jan 2023 09:49:06 +0100
> Cc: juri <at> linkov.net, 60886 <at> debbugs.gnu.org
> From: martin rudalics <rudalics <at> gmx.at>
> 
>  >> What is the "same buffer" when the root window is internal in
>  >> split-root-window-right/-below?
>  >
>  > I guess "the same buffer as the window which was split"?
> 
> In the case sketched above the window which was split had no buffer.

I guess I don't understand the use case then? how can that happen?
And what would you suggest to say in the doc string instead?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60886; Package emacs. (Thu, 19 Jan 2023 10:44:02 GMT) Full text and rfc822 format available.

Message #34 received at 60886 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 60886 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#60886: 29.0.60; split-root-window-below broken for
 split-window-keep-point
Date: Thu, 19 Jan 2023 11:43:09 +0100
> I guess I don't understand the use case then? how can that happen?

With emacs -Q do

M-: (pop-to-buffer "*Messages*")
C-x w 3

> And what would you suggest to say in the doc string instead?

Either nothing or what 'split-window' says in that case: That the new
window shows the buffer of the window selected on the frame containing
the window that was split.

Functions like 'split-window-below' were historically intended for
interactive use only.  The Elisp manual said about them

   For interactive use, Emacs provides two commands which always split
   the selected window.

which apparently is no longer true.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60886; Package emacs. (Thu, 19 Jan 2023 11:33:02 GMT) Full text and rfc822 format available.

Message #37 received at 60886 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 60886 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#60886: 29.0.60; split-root-window-below broken for
 split-window-keep-point
Date: Thu, 19 Jan 2023 13:32:25 +0200
> Date: Thu, 19 Jan 2023 11:43:09 +0100
> Cc: juri <at> linkov.net, 60886 <at> debbugs.gnu.org
> From: martin rudalics <rudalics <at> gmx.at>
> 
>  > I guess I don't understand the use case then? how can that happen?
> 
> With emacs -Q do
> 
> M-: (pop-to-buffer "*Messages*")
> C-x w 3

This shows *Messages* in the new window, so I think something like

  ...the same buffer as the window which was selected when the
  function was invoked"

should be good.

>  > And what would you suggest to say in the doc string instead?
> 
> Either nothing or what 'split-window' says in that case: That the new
> window shows the buffer of the window selected on the frame containing
> the window that was split.

See above.

> Functions like 'split-window-below' were historically intended for
> interactive use only.  The Elisp manual said about them
> 
>     For interactive use, Emacs provides two commands which always split
>     the selected window.
> 
> which apparently is no longer true.

That doesn't say "only for interactive use", and it would make no
sense to say that for such a basic function, IMO.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60886; Package emacs. (Fri, 20 Jan 2023 09:18:01 GMT) Full text and rfc822 format available.

Message #40 received at 60886 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 60886 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#60886: 29.0.60; split-root-window-below broken for
 split-window-keep-point
Date: Fri, 20 Jan 2023 10:17:39 +0100
>> M-: (pop-to-buffer "*Messages*")
>> C-x w 3
>
> This shows *Messages* in the new window, so I think something like
>
>    ...the same buffer as the window which was selected when the
>    function was invoked"
>
> should be good.

This would miss the case where WINDOW-TO-SPLIT is live and not selected.
And also the case where the root window of a non-selected frame should
be split.

>> The Elisp manual said about them
>>
>>      For interactive use, Emacs provides two commands which always split
>>      the selected window.
>>
>> which apparently is no longer true.
>
> That doesn't say "only for interactive use", and it would make no
> sense to say that for such a basic function, IMO.

I meant the "always split the selected window" part.  Just think of how
much easier it would have been, had these new functions been coded as

(defun split-root-window-below (&optional size)
  "Split root window of selected frame in two.
The current window configuration is retained in the top window,
the lower window takes up the whole width of the frame.  SIZE is
handled as in `split-window-below'.  The buffer of the new window is
taken from the selected window."
  (interactive "P")
  (when (and size (< size 0) (< (- size) window-min-height))
    ;; `split-window' would not signal an error here.
    (error "Size of new window too small"))
  (split-window (frame-root-window) size 'below))

(defun split-root-window-right (&optional size)
  "Split root window of selected frame into two side-by-side windows.
The current window configuration is retained within the left
window, and a new window is created on the right, taking up the
whole height of the frame.  SIZE is treated as by
`split-window-right'.  The buffer of the new window is taken from
the selected window."
  (interactive "P")
  (when (and size (< size 0) (< (- size) window-min-width))
    ;; `split-window' would not signal an error here.
    (error "Size of new window too small"))
  (split-window (frame-root-window) size 'right))

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60886; Package emacs. (Sat, 21 Jan 2023 08:18:02 GMT) Full text and rfc822 format available.

Message #43 received at 60886 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 60886 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#60886: 29.0.60; split-root-window-below broken for
 split-window-keep-point
Date: Sat, 21 Jan 2023 10:16:56 +0200
> Date: Fri, 20 Jan 2023 10:17:39 +0100
> Cc: juri <at> linkov.net, 60886 <at> debbugs.gnu.org
> From: martin rudalics <rudalics <at> gmx.at>
> 
>  >> M-: (pop-to-buffer "*Messages*")
>  >> C-x w 3
>  >
>  > This shows *Messages* in the new window, so I think something like
>  >
>  >    ...the same buffer as the window which was selected when the
>  >    function was invoked"
>  >
>  > should be good.
> 
> This would miss the case where WINDOW-TO-SPLIT is live and not selected.
> And also the case where the root window of a non-selected frame should
> be split.

OK, then how about

   ...the same buffer as shown in WINDOW-TO-SPLIT

?

>  >> The Elisp manual said about them
>  >>
>  >>      For interactive use, Emacs provides two commands which always split
>  >>      the selected window.
>  >>
>  >> which apparently is no longer true.
>  >
>  > That doesn't say "only for interactive use", and it would make no
>  > sense to say that for such a basic function, IMO.
> 
> I meant the "always split the selected window" part.

That is still correct in interactive use, isn't it?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60886; Package emacs. (Sat, 21 Jan 2023 10:09:02 GMT) Full text and rfc822 format available.

Message #46 received at 60886 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 60886 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#60886: 29.0.60; split-root-window-below broken for
 split-window-keep-point
Date: Sat, 21 Jan 2023 11:08:32 +0100
> OK, then how about
>
>     ...the same buffer as shown in WINDOW-TO-SPLIT

We are going in circles.  This fails when WINDOW-TO-SPLIT is internal.

> I meant the "always split the selected window" part.
>
> That is still correct in interactive use, isn't it?

It's misleading as the current discussion shows.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60886; Package emacs. (Sat, 21 Jan 2023 11:40:01 GMT) Full text and rfc822 format available.

Message #49 received at 60886 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 60886 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#60886: 29.0.60; split-root-window-below broken for
 split-window-keep-point
Date: Sat, 21 Jan 2023 13:39:19 +0200
> Date: Sat, 21 Jan 2023 11:08:32 +0100
> Cc: juri <at> linkov.net, 60886 <at> debbugs.gnu.org
> From: martin rudalics <rudalics <at> gmx.at>
> 
>  > OK, then how about
>  >
>  >     ...the same buffer as shown in WINDOW-TO-SPLIT
> 
> We are going in circles.

I'm trying my best, sorry.  Could use some help, I guess.

> This fails when WINDOW-TO-SPLIT is internal.

Which buffer will be shown in the new window in that case?

>  > I meant the "always split the selected window" part.
>  >
>  > That is still correct in interactive use, isn't it?
> 
> It's misleading as the current discussion shows.

It's a minor issue, so let's not lose the focus.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60886; Package emacs. (Sat, 21 Jan 2023 15:32:01 GMT) Full text and rfc822 format available.

Message #52 received at 60886 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 60886 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#60886: 29.0.60; split-root-window-below broken for
 split-window-keep-point
Date: Sat, 21 Jan 2023 16:30:57 +0100
>> This fails when WINDOW-TO-SPLIT is internal.
>
> Which buffer will be shown in the new window in that case?

If WINDOW-TO-SPLIT is live, the buffer shown in the new window is the
buffer shown in WINDOW-TO-SPLIT.

If WINDOW-TO-SPLIT is not live, the buffer shown in the new window is
the buffer shown in the selected window of WINDOW-TO-SPLIT's frame.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60886; Package emacs. (Sat, 21 Jan 2023 15:56:01 GMT) Full text and rfc822 format available.

Message #55 received at 60886 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 60886 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#60886: 29.0.60; split-root-window-below broken for
 split-window-keep-point
Date: Sat, 21 Jan 2023 17:55:27 +0200
> Date: Sat, 21 Jan 2023 16:30:57 +0100
> Cc: juri <at> linkov.net, 60886 <at> debbugs.gnu.org
> From: martin rudalics <rudalics <at> gmx.at>
> 
>  >> This fails when WINDOW-TO-SPLIT is internal.
>  >
>  > Which buffer will be shown in the new window in that case?
> 
> If WINDOW-TO-SPLIT is live, the buffer shown in the new window is the
> buffer shown in WINDOW-TO-SPLIT.
> 
> If WINDOW-TO-SPLIT is not live, the buffer shown in the new window is
> the buffer shown in the selected window of WINDOW-TO-SPLIT's frame.

Thanks.  Then I suggest

    Split WINDOW-TO-SPLIT into two windows, one above the other.
  WINDOW-TO-SPLIT defaults to the selected window if omitted or nil.
  The newly created window will be below WINDOW-TO-SPLIT and will show
  the same buffer as WINDOW-TO-SPLIT, if it is a live window, else the
  buffer shown in the WINDOW-TO-SPLIT's frame's selected window.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60886; Package emacs. (Sat, 21 Jan 2023 18:36:01 GMT) Full text and rfc822 format available.

Message #58 received at 60886 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 60886 <at> debbugs.gnu.org
Subject: Re: bug#60886: 29.0.60; split-root-window-below broken for
 split-window-keep-point
Date: Sat, 21 Jan 2023 19:57:40 +0200
> Just think of how much easier it would have been, had these new
> functions been coded as
>
> (defun split-root-window-below (&optional size)
>   "Split root window of selected frame in two.
> The current window configuration is retained in the top window,
> the lower window takes up the whole width of the frame.  SIZE is
> handled as in `split-window-below'.  The buffer of the new window is
> taken from the selected window."
>   (interactive "P")
>   (when (and size (< size 0) (< (- size) window-min-height))
>     ;; `split-window' would not signal an error here.
>     (error "Size of new window too small"))
>   (split-window (frame-root-window) size 'below))
>
> (defun split-root-window-right (&optional size)
>   "Split root window of selected frame into two side-by-side windows.
> The current window configuration is retained within the left
> window, and a new window is created on the right, taking up the
> whole height of the frame.  SIZE is treated as by
> `split-window-right'.  The buffer of the new window is taken from
> the selected window."
>   (interactive "P")
>   (when (and size (< size 0) (< (- size) window-min-width))
>     ;; `split-window' would not signal an error here.
>     (error "Size of new window too small"))
>   (split-window (frame-root-window) size 'right))

I proposed the same in bug#56767.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60886; Package emacs. (Sun, 22 Jan 2023 09:54:02 GMT) Full text and rfc822 format available.

Message #61 received at 60886 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 60886 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#60886: 29.0.60; split-root-window-below broken for
 split-window-keep-point
Date: Sun, 22 Jan 2023 10:53:20 +0100
>      Split WINDOW-TO-SPLIT into two windows, one above the other.
>    WINDOW-TO-SPLIT defaults to the selected window if omitted or nil.
>    The newly created window will be below WINDOW-TO-SPLIT and will show
>    the same buffer as WINDOW-TO-SPLIT, if it is a live window, else the
>    buffer shown in the WINDOW-TO-SPLIT's frame's selected window.

Sounds correct.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60886; Package emacs. (Sun, 22 Jan 2023 09:54:02 GMT) Full text and rfc822 format available.

Message #64 received at 60886 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> linkov.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 60886 <at> debbugs.gnu.org
Subject: Re: bug#60886: 29.0.60; split-root-window-below broken for
 split-window-keep-point
Date: Sun, 22 Jan 2023 10:53:49 +0100
> I proposed the same in bug#56767.

That would have avoided nonsense like retrieving 'window-point' of an
uninvolved window or the 'quit-restore' parameter of an internal window.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60886; Package emacs. (Sun, 22 Jan 2023 17:14:02 GMT) Full text and rfc822 format available.

Message #67 received at 60886 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 60886 <at> debbugs.gnu.org
Subject: Re: bug#60886: 29.0.60; split-root-window-below broken for
 split-window-keep-point
Date: Sun, 22 Jan 2023 19:09:34 +0200
>> I proposed the same in bug#56767.
>
> That would have avoided nonsense like retrieving 'window-point' of an
> uninvolved window or the 'quit-restore' parameter of an internal window.

Then I don't know what to do at this time before the release:
whether to rewrite them or not.

Also these commands are missing:

(defun split-root-window-above (&optional size)
  (interactive "P")
  (when (and size (< size 0) (< (- size) window-min-height))
    ;; `split-window' would not signal an error here.
    (error "Size of new window too small"))
  (split-window (frame-root-window) size 'above))

(defun split-root-window-left (&optional size)
  (interactive "P")
  (when (and size (< size 0) (< (- size) window-min-width))
    ;; `split-window' would not signal an error here.
    (error "Size of new window too small"))
  (split-window (frame-root-window) size 'left))

There are no corresponding split-window-above and split-window-left,
because they provide the same result as the existing
split-window-below and split-window-right.  But there is no way
to add a window on the left/above for the root window
by using split-root-window-below or split-root-window-right.
Therefore split-root-window-above and split-root-window-left
are needed.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60886; Package emacs. (Tue, 24 Jan 2023 18:00:02 GMT) Full text and rfc822 format available.

Message #70 received at 60886 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 60886 <at> debbugs.gnu.org
Subject: Re: bug#60886: 29.0.60; split-root-window-below broken for
 split-window-keep-point
Date: Tue, 24 Jan 2023 19:55:43 +0200
>> I proposed the same in bug#56767.
>
> That would have avoided nonsense like retrieving 'window-point' of an
> uninvolved window or the 'quit-restore' parameter of an internal window.

Maybe if it's an internal window it should fall back to the selected window
to get the 'quit-restore' parameter?

OTOH, the new argument WINDOW-TO-SPLIT makes sense for
split-window-below and split-window-right when it's not
an internal window, to be able to split any non-selected window.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60886; Package emacs. (Thu, 26 Jan 2023 08:02:01 GMT) Full text and rfc822 format available.

Message #73 received at 60886 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 60886 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#60886: 29.0.60; split-root-window-below broken for
 split-window-keep-point
Date: Thu, 26 Jan 2023 10:01:36 +0200
> Date: Sun, 22 Jan 2023 10:53:20 +0100
> Cc: juri <at> linkov.net, 60886 <at> debbugs.gnu.org
> From: martin rudalics <rudalics <at> gmx.at>
> 
>  >      Split WINDOW-TO-SPLIT into two windows, one above the other.
>  >    WINDOW-TO-SPLIT defaults to the selected window if omitted or nil.
>  >    The newly created window will be below WINDOW-TO-SPLIT and will show
>  >    the same buffer as WINDOW-TO-SPLIT, if it is a live window, else the
>  >    buffer shown in the WINDOW-TO-SPLIT's frame's selected window.
> 
> Sounds correct.

Thanks, installed.

Btw, the doc string of split-window-right incorrectly said that the
new window will be to the _left_; I fixed that as well.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60886; Package emacs. (Thu, 26 Jan 2023 15:45:02 GMT) Full text and rfc822 format available.

Message #76 received at 60886 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 60886 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#60886: 29.0.60; split-root-window-below broken for
 split-window-keep-point
Date: Thu, 26 Jan 2023 16:44:45 +0100
> Btw, the doc string of split-window-right incorrectly said that the
> new window will be to the _left_; I fixed that as well.

Are you sure?  Looking at this diff

https://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-29&id=41f497c8bee6e36a621a6d9088636069159387a9

I see

-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.
+WINDOW-TO-SPLIT defaults to the selected window if omitted or nil.
+The newly created window will be to the right of WINDOW-TO-SPLIT and
+will show the same buffer as WINDOW-TO-SPLIT, if it is a live window,
+else the buffer shown in the WINDOW-TO-SPLIT's frame's selected window.
+Return the new window.

Or am I missing something?

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60886; Package emacs. (Thu, 26 Jan 2023 16:41:02 GMT) Full text and rfc822 format available.

Message #79 received at 60886 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 60886 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#60886: 29.0.60; split-root-window-below broken for
 split-window-keep-point
Date: Thu, 26 Jan 2023 18:40:05 +0200
> Date: Thu, 26 Jan 2023 16:44:45 +0100
> Cc: juri <at> linkov.net, 60886 <at> debbugs.gnu.org
> From: martin rudalics <rudalics <at> gmx.at>
> 
>  > Btw, the doc string of split-window-right incorrectly said that the
>  > new window will be to the _left_; I fixed that as well.
> 
> Are you sure?  Looking at this diff
> 
> https://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-29&id=41f497c8bee6e36a621a6d9088636069159387a9
> 
> I see
> 
> -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.
> +WINDOW-TO-SPLIT defaults to the selected window if omitted or nil.
> +The newly created window will be to the right of WINDOW-TO-SPLIT and
> +will show the same buffer as WINDOW-TO-SPLIT, if it is a live window,
> +else the buffer shown in the WINDOW-TO-SPLIT's frame's selected window.
> +Return the new window.
> 
> Or am I missing something?

Ignore me, the original text confused me.  The new one doesn't.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 24 Feb 2023 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 62 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.