emacs-devel
[Top][All Lists]
Advanced

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

`min-margins' window parameter.


From: Joost Kremers
Subject: `min-margins' window parameter.
Date: Fri, 06 Nov 2020 13:37:24 +0100
User-agent: mu4e 1.5.6; emacs 27.1.50

Hi,

In Emacs 25, the window parameter `min-margins' was added, after several
discussions here and on bug-gnu-emacs about vertically splitting windows with
wide margins.

I've now finally started converting my code to use this parameter,[1] but it
doesn't seem to be working as expected.

When I invoke `C-x 3` (`split-window-right`) on a window with
`visual-fill-column-mode` enabled, the split sometimes works as expected, but
most of the time it doesn't. What I expect is for the window to be split in to
side-by-side windows of equal size. What happens most of the time is that the
window is split into two unevenly-sized windows, with the left window about as
wide as the text area before the split and the right window taking up the rest
of the original window.

Twice during my tests Emacs actually hung, driving one of the CPU cores to 100%.

I haven't been able to determine when the split works right and when it doesn't.
It seems to be fairly random. Since all the relevant code runs during redisplay,
Edebug doesn't seem to work. (At least ISTR that being the case.)

The relevant code is here:

https://github.com/joostkremers/visual-fill-column/tree/winparam

Basically, what the code does is set the right margin of the window to some
calculated width whenever the window size changes (i.e., whenever the hook
`window-size-change-functions` is run). At the same time, the window parameter
`min-margins` is set to `(0 . 0)` to allow splitting.[2]

Is this the correct way of using the window parameter `min-margins`, or have I
overlooked something?

TIA

Joost


PS: I checked to see what `olivetti.el` does, but it still uses the workaround
based on the `split-window` window parameter, that Martin Rudalics once
suggested before `min-margins` was introduced. There seems to be a bug in this
workaround, however, which prompted me to try the `min-margins` window
parameter.


Footnotes:
[1]  I maintain `visual-fill-column-mode` 
(https://github.com/joostkremers/visual-fill-column),
     which is a package that widens the right margin in a buffer so that the
     text is wrapped at `fill-column`. (It assumes that the buffer is using 
`visual-line-mode`.)

[2]  Well, actually it is set to whatever the width of the margins was before
     `visual-fill-column-mode` was invoked.

-- 
Joost Kremers
Life has its moments



reply via email to

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