unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* `min-margins' window parameter.
@ 2020-11-06 12:37 Joost Kremers
  2020-11-06 13:11 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Joost Kremers @ 2020-11-06 12:37 UTC (permalink / raw)
  To: Emacs-Devel List

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-06 14:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-06 12:37 `min-margins' window parameter Joost Kremers
2020-11-06 13:11 ` Eli Zaretskii
2020-11-06 14:19   ` Joost Kremers

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).