Hi Eli, Attached is a v2 patch (for discussion, not yet finished) that demonstrates the approach. Examples of what works and what doesn't: ;; single spec, list of specs, vector of specs all work now (insert (propertize "foo" 'display '(right-fringe left-arrow warning "right tooltip")))foo (insert (propertize "foo" 'display '((left-fringe right-arrow warning "left tooltip"))))foo (insert (propertize "foo" 'display '[(right-fringe left-arrow warning "right tooltip")])) ;; overlays with display props also work (overlay-put (make-overlay 1 2) 'display `(left-fringe right-arrow warning "left tooltip")) ;; overlays with zero length DO NOT work (and provide no fringe indicators) (overlay-put (make-overlay 1 1) 'display `(left-fringe right-arrow warning "left tooltip")) ;; 'before-string and 'after-string DO NOT work (overlay-put (make-overlay (point) (point)) 'before-string (propertize "x" 'display `(left-fringe right-arrow warning "left tooltip"))) Adding (when CONDITION . SPEC) support is easy, still figuring out 'before-string/'after-string. Thanks On Tue, 26 Mar 2024 at 22:16, Vladimir Kazanov wrote: > > Hey, > > I just did a deep dive into the code again - looking for a cleaner solution. > > > The condition is only evaluated at glyph generation time, as for any > > other display property. When the tooltip should be displayed, the > > condition is not relevant, since if it were false when the glyphs were > > generated, you wouldn't have had the fringe bitmap shown in the first > > place. > > > > However, I think there's an easy way of making the implementation > > easier: just introduce a new overlay property called, say, > > fringe-help-echo, and put that property on the same text as the > > display property which produces the fringe. Then the code in > > note_fringe_highlight should simply check if the text which yielded > > the fringe bitmap also has this special property on it, and if so, > > display the tooltip. > > Maybe an even easier solution would work: > > 1. Record buffer position of the fringe display spec in struct it. > Then move it to glyph_row the same way user_fringe_bitmap_id's are > copied over. It is just a ptrdiff so nothing out of place for > glyph_rows. > > 2. In note_fringe_highlight it becomes easy to retrieve the fringe > display spec using a single call to get_char_property_and_overlay(), > no need to iterate over a line, or have the implementation detail leak > into text properties. > > What I don't really understand is whether I should handle overlays > with after-string/before-string properties. Overlays can contain > strings propertized with fringe display specs as well. In fact, there > is an example showing this trick in the manual > (https://www.gnu.org/software/emacs/manual/html_node/elisp/Fringe-Bitmaps.html). > > Should I just go through all overlays touching the spec position and > parse into the after-string/before-string as well? > > Pardon the many questions, display code has many moving parts. > > Thank you > > -- > Regards, > > Vladimir Kazanov -- Regards, Vladimir Kazanov