unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Platon Pronko <platon7pronko@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>, help-gnu-emacs@gnu.org
Subject: Re: Moving point around empty overlays with 'after-text
Date: Mon, 10 Apr 2023 17:05:44 +0800	[thread overview]
Message-ID: <9cb22a11-8ca9-8b2c-bb6d-c2ec2ebb5330@gmail.com> (raw)
In-Reply-To: <831qkscgfv.fsf@gnu.org>

On 2023-04-10 16:03, Eli Zaretskii wrote:
>> front-advance and rear-advance control if the typed text should be included in overlay. In case of inline type hints, typed text never needs to be included.
> 
> Is that the only effect of front-advance and rear-advance in this
> case?

I get your point, you are talking about moving the overlay forward if characters are typed before the overlay :)
But for zero-width overlays it never moves the overlay - I tested different variations, and right now no combination of these properties allows one to insert characters before the inlay:

nil nil => characters are inserted after the overlay
nil t => characters are not visible (because they are inside overlay)
t nil => characters are inserted after the overlay
t t => characters are inserted after the overlay

>> I did. All these examples are about consitently positioning cursor before or after overlay at all times, and they of course work. But none of them allow cursor position to move from beginning to the end of overlay without nasty hacks with detecting cursor position and manually changing overlay properties.
> 
> I'm not sure which part(s) are considered "nasty hacks" in your eyes,
> given that you are already okay with using "empty" overlays for
> displaying the hints.

I'm definitely not okay with using empty overlays. My whole point is that it would be nice to have some alternative well-defined way to have inline text, and not resort to trying to force overlays into doing what they are not supposed to. Currently lsp-mode, eglot, company-mode, auto-complete (and bunch of lesser-known packages that copied code from them) all try to use overlays for this, and that's probably not the best thing.

We have narrowing and invisible text properties - these provide a way to hide a portion of the buffer.
We have overlays - these provide a way to replace a portion of the buffer with something else.
But we seem to miss the capability to reliably show stuff that isn't actually in the buffer.

> In any case, an overlay can have a 'keymap'
> property, where you could perhaps redefine what C-f, C-b, and perhaps
> some other relevant movement commands do.  Did you try that?

Yes. Keymap is only used when front-advance is nil and rear-advance is t, which coincidentally is the only combination that causes typed characters to be "hidden" by the overlay. (perhaps I am doing something incorrectly, however)

But even if I could override C-f and some other keys, that would still be only a half-solution - people might bind forward-char and backward-char to different keys, or they might be using entirely different methods of moving around the buffer (for example I am using avy-goto-char often). I don't think there is a way to handle all such cases by simply overriding the keymap.

-- 
Best regards,
Platon Pronko
PGP 2A62D77A7A2CB94E




  reply	other threads:[~2023-04-10  9:05 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-08  5:46 Moving point around empty overlays with 'after-text Ash
2023-04-08 10:06 ` Eli Zaretskii
2023-04-08 10:14   ` Platon Pronko
2023-04-08 10:10 ` Platon Pronko
2023-04-08 23:06   ` Ash
2023-04-09 12:15     ` Platon Pronko
2023-04-09 14:49       ` tomas
2023-04-10  1:52         ` Platon Pronko
2023-04-10  4:56           ` Eli Zaretskii
2023-04-10  5:22             ` Platon Pronko
2023-04-10  9:56               ` Yuri Khan
2023-04-11  8:49                 ` Platon Pronko
2023-04-11  9:41                   ` Yuri Khan
2023-04-10  5:35           ` tomas
2023-04-10  5:48             ` Platon Pronko
2023-04-09 20:44       ` Ash
2023-04-10  2:00         ` Platon Pronko
2023-04-10  3:21           ` Ash
2023-04-10  3:31             ` Platon Pronko
2023-04-11  0:22               ` Ash
2023-04-10  5:09             ` Eli Zaretskii
2023-04-10  5:37               ` Platon Pronko
2023-04-10  8:03                 ` Eli Zaretskii
2023-04-10  9:05                   ` Platon Pronko [this message]
2023-04-10  5:01           ` Eli Zaretskii
2023-04-10  5:26             ` Platon Pronko

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=9cb22a11-8ca9-8b2c-bb6d-c2ec2ebb5330@gmail.com \
    --to=platon7pronko@gmail.com \
    --cc=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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).