unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Joost Kremers <joostkremers@fastmail.fm>
To: Emacs-Devel List <emacs-devel@gnu.org>
Subject: `min-margins' window parameter.
Date: Fri, 06 Nov 2020 13:37:24 +0100	[thread overview]
Message-ID: <878sbevjtp.fsf@fastmail.fm> (raw)

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	other threads:[~2020-11-06 12:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-06 12:37 Joost Kremers [this message]
2020-11-06 13:11 ` `min-margins' window parameter Eli Zaretskii
2020-11-06 14:19   ` Joost Kremers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878sbevjtp.fsf@fastmail.fm \
    --to=joostkremers@fastmail.fm \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).