bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#29279: Sharing the margins


From: Dmitry Gutov
Subject: bug#29279: Sharing the margins
Date: Mon, 13 Nov 2017 19:54:45 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:56.0) Gecko/20100101 Thunderbird/56.0

On 11/13/17 5:46 PM, Eli Zaretskii wrote:
I tend to like better the proposal originally made by Joost Kremers in
http://lists.gnu.org/archive/html/emacs-devel/2015-11/msg01540.html.
Here it is with slight variations of my own:

Overall, it seems like a friendlier API over fairly similar structures as what I suggested (just replace left-margin-columns-alist with left-margin-params). Except SYMBOL is not given a meaningful name (they are "columns" in my description).

We add 3 new functions:

  (defun window-margin-add (window side symbol cols &optional ordinal)
    "Request allocation of COLS columns of WINDOW's marginal area.
  WINDOW must be a live window and defaults to the selected one.
  SIDE is the window side, either `left' or `right', in whose margin
    the allocation is requested.
  SYMBOL identifies the request, in case the allocation needs to be
    changed or deleted.
  ORDINAL is the optional ordinal number of the requested area, counted
    from left to right.  Negative ordinal numbers count from right to
    left.  Zero means the value of COLS is the maximum width of the
    marginal area, and no separate allocation is requested.

ORDINAL meaning the same as "order priority"? And the lower the value is, the more "left" the column should be positioned? Sounds OK to me.

I'm not sure I understand the "Zero means ..." passage, though.

In addition to signifying a neutral position, does it supposed to switch the meaning of this function into something that set-right-margin/set-left-margin can call, for backward compatibility?

Seems like a wart, using ORDINAL this way. And what's going to happen when somebody else calls window-margin-add with non-zero ORDINAL? Will the end result depend on which call happens first?

  Value is the actual positive ordinal number of the allocated area."

Return value?

If the stuff (text, image, etc.) to be displayed in a specified
portion of the marginal area is too wide and doesn't fit the width of
the portion, it will be truncated; if it is narrower, it will be
padded.

Padded from the left or from the right? :)

This keeps the display engine design intact, and I think will allow
relatively straightforward implementation (although some non-trivial
changes in management of the glyph matrices will be necessary).  It
can also be implemented in a way that keeps backward compatibility
with the current APIs.

WDYT?

Aside from the ORDINAL edge case, it sounds good to me.

Here's an interesting question: after such an API is added, will it be feasible to re-implement display-line-numbers-mode using a margin column, instead of the special separate area?

And if not, how can we make this API better that you could?





reply via email to

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