[Top][All Lists]

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

Re: Window splitting issues with margins

From: martin rudalics
Subject: Re: Window splitting issues with margins
Date: Tue, 24 Nov 2015 20:26:01 +0100

> Well, I tried implementing this policy in `visual-fill-column-mode', but
> it didn't work, because it's not clear at all where margins come from.
> E.g., suppose `nlinum-mode' and `visual-fill-column-mode' are both
> active in a buffer. Now, `nlinum-mode' only sets the left margin, so
> when `visual-fill-column-mode' needs to reset the margins, the existing
> width of the right margin has been set by `visual-fill-column-mode'
> during the previous margin update. The problem is that
> `visual-fill-column-mode' has no way of knowing this and therefore
> assumes it cannot reduce the right margin, even though it can.
> So, summarising, the situation as it is doesn't really provide a way to
> allow multiple packages to use the margins safely. Making that possible
> would require some big changes to the way margins are handled.

I think we agree that ‘nlinum-mode’ and ‘visual-fill-column-mode’ have
to file their requests via ‘set-window-margins’ and the latter uses the
maximum value requested.  All this is simple until the moment when the
mode that requested the current maximum size gets turned off.

In any case I would maintain a window parameter as a list of requested
margin widths like ((4 . 0) (40 . 40)).  Basically there are then two
ways to handle this: Let ‘set-window-margins’ decide or let the modes
agree among themselves.

For the former, when a mode gets turned off it calls, for example,
(set-window-margins nil -40 -40) and ‘set-window-margins’ decides that
there is one contender less for a left margin width of 40 and a right
margin width of 40 and it may have to set new widths.  -0 might require
special care.

Having the modes agree among themselves means that a mode that wants to
change the margins has to consult that parameter, add its own value to
it and only if its own value is larger than the current value, use it in
a call to ‘set-window-margins’.  When a mode is turned off, it has to
remove its value from the window parameter, and possibly call
‘set-window-margins’ with the new largest value.



reply via email to

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