[Top][All Lists]

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

Re: Better handling of window margins

From: martin rudalics
Subject: Re: Better handling of window margins
Date: Wed, 02 Dec 2015 09:23:13 +0100

> * Amend `set-window-margins' to take two additional parameters:
>    (set-window-margins WINDOW LEFT-WIDTH &optional RIGHT-WIDTH SYM DYNAMIC)
>    SYM is a symbol (chosen by the caller) that identifies the mode that
>    is setting the margins.

Thinking about this twice, I'd rather leave the arguments of
‘set-window-margins’ alone.  Instead, ‘set-window-margins’ should call a
‘set-window-margins-function’ provided it's defined and delegate the
decision of how to proceed to that function.  The caller would set up
SYM and DYNAMIC directly via ‘window-margins-alist’ before calling
‘set-window-margins’.  And the function specified by
‘set-window-margins-function’ would decide how to process
‘window-margins-alist’.  This way we can easily code all the new parts
in Elisp and at the end have the function specified by
‘set-window-margins-function’ call back ‘set-window-margins’ with
‘set-window-margins-function’ let-bound to nil.

> * `window-splittable-p' can check the contents of `window-margins-alist'
>    and use the info to determine whether a window can be split
>    horizontally: dynamic margins can be adjusted, so the horizontal
>    splittability should be determined on the basis of text width plus
>    dynamic margins minus static margins. In the present example:
>    (+ (- 40 4 2) (- 40 0 0) (window-text-width))
>    This value would be used instead of (window-width) in the current
>    implementation of `window-splittable-p'.
> * If the value of `window-margin-alist' is nil, but the margins are
>    non-nil, `window-splittable-p' should behave as it does now.
> * Obviously, `window-splittable-p' (or any function that calls it)
>    should not update the margins itself. That is up to the modes that use
>    the margins, using `window-configuration-change-hook'.

That's not sufficient.  We have to incorporate code handling dynamic
margins in practically all functions that resize windows as a whole
(like ‘set-frame-width’, ‘split-window-right’, ‘enlarge-window’ with
second argument non-nil) or only parts of it (like ‘set-window-fringes’
and ‘set-window-scroll-bars’).

For this purpose we have to change ‘window-min-size’ (more precisely
‘window--min-size-1’ or maybe just ‘window-margins’) and things like


reply via email to

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