[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#44483: 27.1.50; Window parameter `min-margins' doesn't split window
From: |
Joost Kremers |
Subject: |
bug#44483: 27.1.50; Window parameter `min-margins' doesn't split window in half |
Date: |
Fri, 06 Nov 2020 17:25:07 +0100 |
User-agent: |
mu4e 1.5.6; emacs 27.1.50 |
On Fri, Nov 06 2020, Eli Zaretskii wrote:
>> From: Joost Kremers <joostkremers@fastmail.fm>
>> Date: Fri, 06 Nov 2020 15:09:36 +0100
>>
>>
>> 1. Open any text file, preferably with long lines (to better see the effect).
>>
>> 2. `M-x visual-line-mode RET`
>>
>> 3. `M-: (set-window-margins (selected-window) 0 150) RET`
>>
>> The number 150 is arbitrary. It's appropriate for my case (with a frame
>> width of
>> about 238 characters).
>>
>> 4. `M-: (set-window-parameter (selected-window) 'min-margins '(0 . 0)) RET`
>>
>> 5. `C-x 3`
>>
>> At this point, I expect the window to be split into two equally-sized
>> side-by-side windows, but the split is at about one third of the original
>> window
>> width.
>
> That expectation is incorrect by default.
Well, let me put it this way: If I split a window in which the margins are nil,
`split-window-right`, in my experience, always splits the window in half.
(Perhaps there are cases where that is not guaranteed, I don't know, but I've
never seen any.)
My (perhaps naive) expectation was that with `min-margins' set to (0 . 0),
`split-window' essentially treats this window as if the margins are nil, so I
expected to get a 50/50 split.
> To have the windows
> equally-sized, you need to set window-combination-resize to t, AFAIU,
> otherwise Emacs makes no promise that your expectation will be heeded.
A quick check suggests that `window-combination-resize' has no effect here. I
still get the 1/3 - 2/3 split at least some of the time. (Mind you, I'm
splitting a window that's the single window in its frame, so AFAIU there is no
window combination to speak of, and `window-combination-resize' should have no
visible effect, from what I can tell from its documentation.)
>> Note that in this recipe, the margins of the two windows aren't adjusted
>> after
>> the split, so in the left window the text is not visible at all and in the
>> right
>> window, the text area is two characters wide. (In my case, YMMV.)
>
> You expected Emacs to adjust the margins?
No, I don't. `visual-fill-column-mode' makes sure the margins are resized after
the split. That works as it should. I just mentioned it here because that part
of `visual-fill-column-mode' isn't replicated by the recipe. But that's not
relevant here, so just ignore it.
> The min-margins parameters
> is consulted only when determining whether the window can be split, it
> has no effect whatsoever on the window dimensions after the split.
Yeah, but that's exactly what I'm stumbling over. I've never seen such a 1/3-2/3
split, but now I'm suddenly getting it. So something is causing split-window to
treat a window with wide margins and `min-margins' set to (0 . 0) differently
from a window with no margins (but otherwise equally sized in an equally sized
frame).
Whether that something is a bug or not, I can't say. If it's not, though, I'd
really like to know if there's a workaround.
--
Joost Kremers
Life has its moments