[Top][All Lists]

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

Re: Window splitting issues with margins

From: Joost Kremers
Subject: Re: Window splitting issues with margins
Date: Mon, 16 Nov 2015 17:56:55 +0100
User-agent: mu4e 0.9.13; emacs

On Mo, Nov 16 2015, Eli Zaretskii <address@hidden> wrote:
>> From: Joost Kremers <address@hidden>
>> Date: Sat, 14 Nov 2015 21:34:09 +0100
>> Cc: martin rudalics <address@hidden>, address@hidden
>> It's just that I think both issues could be solved by the same
>> mechanism: allowing a (minor) mode to lock the margins to a certain
>> minimum width. window-splittable-p could then assume that those parts of
>> the margins that are not locked can be reduced along with the text area,
>> unlike now, where the underlying assumption seems to be that if the
>> margins are > 0, there's probably a reason for it and they shouldn't be
>> reduced.
>> At the same time, it would allow linum-mode and writeroom-mode to play
>> nice together: instead of setting the margin to the size it requires for
>> line numbers, linum-mode could set a minimum size, allowing other
>> packages to make them wider. writeroom-mode then would not be allowed to
>> set margins to less than the minimum size.
> But this will only work in a very special case: when only one mode
> actually displays something in the margin.  Once another mode wants to
> put something there, all bets are off.  Right?

Yes, but isn't that currently the case as well?

Of course, to do it right, you'd have to come up with a scheme that
allows any number of modes to play nice. Perhaps a function
`add-to-window-margin N SYM' that a mode can use to add N columns to the
margin and have SYM added as a property of some sort or a window
parameter indicating which column(s) were added, and a similar function
`remove-from-window-margin SYM', which removes those columns again.
Modes could then manage their own part of the margins without stomping
on other modes. (A mode would simply request a number of columns, it
wouldn't need to know if it gets columns 1-4, or 5-6, etc., although it
could find that out by examining the SYM property/parameter.) Columns
that have such an associated SYM property are not considered reducible
by `window-splittable-p'.

It would still have to be possible for modes like writeroom-mode to set
the margin to a specific width without setting a property, but those
margins would be considered reducible by `window-splittable-p'.
Furthermore, it shouldn't be possible to set a width that is smaller
than what other modes have set. This could either be enforced by the API
or writeroom-mode would have to ensure this itself.

Anyway, it seems something similar is being discussed in the thread on
the linum patch, although as a more general option.

Joost Kremers
Life has its moments

reply via email to

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