emacs-devel
[Top][All Lists]
Advanced

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

Re: Colorful line numbers


From: Eli Zaretskii
Subject: Re: Colorful line numbers
Date: Fri, 22 Jul 2022 16:27:56 +0300

> From: João Távora <joaotavora@gmail.com>
> Cc: emacs-devel@gnu.org
> Date: Fri, 22 Jul 2022 13:02:01 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> Does checking for a given text property on some buffer text call into
> >> Lisp?  If it isn't, and it's cheap, then this hypothetical feature could
> >> have very low overhead when not used.
> > You want the line number to have the same face as the character
> > displayed immediately after it?
> 
> Not the "same face", rather some face which is the result of querying
> text properties on that text. 

I don't understand what that means.  Querying the properties how?  And
doing what with the results of those queries?  Eventually, you need a
face.

> > That can be done from C without calling Lisp, but how would that work
> > reliably?  Any change in the buffer text will risk breaking the
> > feature.
> 
> It's up to the Lisp package that is interested in this functionality to
> set or unset the correct text property. 

Well, good luck with that!  Because I don't think this can be
reasonably implemented from Lisp: there are too many aspects involved
that are hidden from Lisp.

> > And even this is already a complication I'd like to avoid: line number
> > of a line is rendered before we examine the buffer text of the line
> > (and even know whether there is any text there).  Now we would need to
> > look forward in the buffer and get text properties of that text.
> > Which might not work correctly, btw, if jit-lock was not yet invoked
> > to produce the faces there.
> 
> See above. This wouldn't be a problem because I'm not interesting in
> choosing the same face that jit-lock selected.  The indirection would be
> some text property, say line-number-face

I guess this gets back to the question about "queries" and their
processing?

> > The implementation is in maybe_produce_line_number in xdisp.c.
> 
> Yes, I've seen it (this is would I discovered the closed set of faces).
> But I'm not familiar with xdisp.c code and how to get to the buffer text
> about to be displayed besides the line number (if it indeed exists) and
> the associated text properties of that text.  The only argument passed
> to maybe_produce_line_number is a 'struct it'.  How to go from there to
> any valid buffer position of the same line that the 'struct it' refers
> to?

The answer depends on the condition(s) which that "valid buffer
position" should satisfy.  In general, IT_CHARPOS(*it) gives you the
next buffer position to be processed.



reply via email to

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