[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Removing rollback from VC mode - request for comment
From: |
Jonas Bernoulli |
Subject: |
Re: Removing rollback from VC mode - request for comment |
Date: |
Sun, 14 Dec 2014 13:11:06 +0100 |
Eli Zaretskii <address@hidden> writes:
>> Nicolas Richard <address@hidden> writes:
>>
>> I don't know what Eli has in mind, but perhaps magit-make-margin-overlay
>> is one such thing ?
>
> Yes, it's one of them.
`elisp(Displaying in the Margins)' states that, "to display something in
the margin _in association with_ certain buffer text, without altering
or preventing the display of that text, put a `before-string' property
on the text and put the margin display specification on the contents of
the before-string."
That's what `magit-make-margin-overlay' does:
(defun magit-make-margin-overlay (&rest strings)
(let ((o (make-overlay (point) (line-end-position) nil t)))
(overlay-put o 'evaporate t)
(overlay-put o 'before-string
(propertize "o" 'display
(list '(margin right-margin)
(apply #'concat strings))))))
It seems to me that Magit is doing it the way it is supposed to be doing
it. Is there another undocumented way? Am I missing something?
The documentation above does not explicitly mention that an overlay has
to be used, but I could not get it to work otherwise. There is only one
builtin package which uses `(margin [left|right]-margin)`, Linum-Mode,
and it also uses overlays, in pretty much the same way.
(There is one small difference in that Linum-Mode uses
(make-overlay (point) (point) ...)
while Magit uses
(make-overlay (point) (line-end-position))
which is kinda pointless because it unfortunately does not have the
desired effect of keeping to display the margin's text even when
`line-beginning-position' is scrolled of the window. So yeah, I
could change that).
In summary, yeah this is ugly, but it ain't Magit's fault.
Or do you frown upon Magit making the margin "buffer-local" using
`magit-set-buffer-margin'?
Ps: I am only interested in constructive criticism of Magit's next
branch. Neither broad "it's all wrong", nor wards which used to existed
in 1.2.* or master interest me.
- Re: Removing rollback from VC mode - request for comment, (continued)
- Re: Removing rollback from VC mode - request for comment, Steinar Bang, 2014/12/11
- Re: Removing rollback from VC mode - request for comment, Eli Zaretskii, 2014/12/11
- Re: Removing rollback from VC mode - request for comment, Óscar Fuentes, 2014/12/11
- Re: Removing rollback from VC mode - request for comment, Eli Zaretskii, 2014/12/11
- Re: Removing rollback from VC mode - request for comment, Steinar Bang, 2014/12/11
- Re: Removing rollback from VC mode - request for comment, Stefan Monnier, 2014/12/11
- Re: Removing rollback from VC mode - request for comment, Eli Zaretskii, 2014/12/11
- Re: Removing rollback from VC mode - request for comment, John Mastro, 2014/12/12
- Re: Removing rollback from VC mode - request for comment, Nicolas Richard, 2014/12/12
- Re: Removing rollback from VC mode - request for comment, Eli Zaretskii, 2014/12/12
- Re: Removing rollback from VC mode - request for comment,
Jonas Bernoulli <=
- Re: Removing rollback from VC mode - request for comment, Eli Zaretskii, 2014/12/14
- Re: Removing rollback from VC mode - request for comment, Stefan Monnier, 2014/12/14
- Re: Removing rollback from VC mode - request for comment, Jonas Bernoulli, 2014/12/15
- Re: Removing rollback from VC mode - request for comment, Eli Zaretskii, 2014/12/15
- Re: Removing rollback from VC mode - request for comment, Eli Zaretskii, 2014/12/12
- Re: Removing rollback from VC mode - request for comment, Rasmus, 2014/12/11
- Re: Removing rollback from VC mode - request for comment, Eric S. Raymond, 2014/12/11
- Re: Removing rollback from VC mode - request for comment, Stephen J. Turnbull, 2014/12/11
- Re: Removing rollback from VC mode - request for comment, Eric S. Raymond, 2014/12/11
- Re: Removing rollback from VC mode - request for comment, Steinar Bang, 2014/12/12