unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Vladimir Kazanov <vekazanov@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] User-defined fringe tooltips (a request for review)
Date: Sun, 07 Apr 2024 15:44:26 +0300	[thread overview]
Message-ID: <86y19pz6j9.fsf@gnu.org> (raw)
In-Reply-To: <CAAs=0-0pr01+DnHYb0k6DMVDYSUw4bb+BHhtNTSzo41kJUiOEQ@mail.gmail.com> (message from Vladimir Kazanov on Sun, 7 Apr 2024 12:14:54 +0100)

> From: Vladimir Kazanov <vekazanov@gmail.com>
> Date: Sun, 7 Apr 2024 12:14:54 +0100
> Cc: emacs-devel@gnu.org
> 
> > Like I said earlier: I think it would be better to have the tooltip
> > text in a separate property, not as part of the 'display' property
> > spec.
> >
> > Also, I don't see a need for recording the positions in the glyph_row
> > structure, because finding the glyph that corresponds to buffer/string
> > text with that special property is easy enough.
> 
> Done.
> 
> The code in the patch goes through glyphs of the row under a mouse
> pointer, finds an object that generated the glyph (glyph->object,
> which can be a buffer or a string) and checks if
> left-fringe-help/right-fringe-help text properties are defined.
> Strings from the properties are then displayed as tooltips.
> 
> This only works for properties of visible text that has glyphs
> generated for it. Properties coming from invisible text and
> zero-length overlays are not represented as glyphs as much I can see
> from the code.

Since there can be only one fringe bitmap displayed on each screen
line, Lisp programs don't need the left/right-fringe-help to be put on
the same positions as the display property that generated the fringe
bitmaps.  They can place the left/right-fringe-help property on _any_
position within the same screen line.  (Of course, to make sure these
properties end up on the same screen line as the fringe bitmap, they
should be on positions as close as possible to the ones which cause
the bitmap to be displayed on the fringe, but that shouldn't be too
hard.)  So I think the danger of not showing the tooltip due to
invisible text or text that didn't produce any glyphs is not a real
one, provided that we lift the restriction of having the
left/right-fringe-help property on the same positions as the display
property which produces the fringe bitmap display.  Do you agree?

> ;;; Tooltips will NOT be shown
>   (insert (propertize "foo" 'display '(left-fringe left-arrow warning)
>                       'left-fringe-help "left tooltip"))
>   (insert (propertize "foo" 'display '(right-fringe left-arrow warning)
>                       'right-fringe-help "right tooltip"))
>   (insert (propertize "foo" 'left-fringe-help "left tooltip"))
> 
>   (insert (propertize "foo" 'right-fringe-help "right tooltip"))
> 
> (overlay-put
>    (make-overlay 1 2)
>    'before-string (propertize
>                    "x"
>                    'left-fringe-help "left tooltip"
>                    'display '(left-fringe right-arrow warning)))

It should be enough to put the left/right-fringe-help property on the
character immediately following the display property, to get the
tooltip to display in those cases.



  reply	other threads:[~2024-04-07 12:44 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-19 19:38 [PATCH] User-defined fringe tooltips (a request for review) Vladimir Kazanov
2023-12-20 12:31 ` Eli Zaretskii
2023-12-21 16:51   ` Vladimir Kazanov
2023-12-21 17:37     ` Eli Zaretskii
2023-12-23 13:28       ` Vladimir Kazanov
2023-12-23 13:40         ` Eli Zaretskii
2023-12-24 11:31           ` Vladimir Kazanov
2023-12-24 16:54             ` Eli Zaretskii
2024-03-25 15:55               ` Vladimir Kazanov
2024-03-25 17:11                 ` Eli Zaretskii
2024-03-26 22:16                   ` Vladimir Kazanov
2024-03-27 10:59                     ` Vladimir Kazanov
2024-03-27 11:25                       ` Po Lu
2024-03-27 12:48                         ` Vladimir Kazanov
2024-03-27 11:25                       ` Po Lu
2024-03-31  8:36                       ` Eli Zaretskii
2024-04-07 11:14                         ` Vladimir Kazanov
2024-04-07 12:44                           ` Eli Zaretskii [this message]
2024-04-07 17:07                             ` Vladimir Kazanov
2024-04-07 18:40                               ` Eli Zaretskii
2024-04-08 14:41                                 ` Vladimir Kazanov
2024-04-13  9:14                                   ` Eli Zaretskii
2024-04-13  9:32                                     ` Vladimir Kazanov
2024-04-13 11:21                                       ` Eli Zaretskii
2024-04-13 14:53                                         ` Vladimir Kazanov
2024-04-13 15:47                                           ` Eli Zaretskii
2024-03-27 12:14                     ` Eli Zaretskii
2024-03-27 12:48                       ` Vladimir Kazanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86y19pz6j9.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=vekazanov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).