bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#60886: 29.0.60; split-root-window-below broken for split-window-keep


From: martin rudalics
Subject: 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





reply via email to

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