From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Platon Pronko Newsgroups: gmane.emacs.help Subject: Re: Moving point around empty overlays with 'after-text Date: Mon, 10 Apr 2023 17:05:44 +0800 Message-ID: <9cb22a11-8ca9-8b2c-bb6d-c2ec2ebb5330@gmail.com> References: <9b1654ec-1ac6-4936-860b-2d77dcc4dac7@app.fastmail.com> <28954f0d-205d-b322-4a43-cf4481d1266e@gmail.com> <3a1bb709-d00f-49b8-a2c5-d0ac5b6a82c4@app.fastmail.com> <22b315db-39eb-80b6-1a7c-127f5e703dc1@gmail.com> <2314d321-040a-4466-afdb-4317df7e6584@app.fastmail.com> <01206f38-741a-b75b-4efe-ecf7c70c6d61@gmail.com> <66d58398-8eb5-4d89-8e7c-4400f180448f@app.fastmail.com> <83lej0l3w5.fsf@gnu.org> <353c12ab-fddd-c7da-c8bc-065a2c8a26e9@gmail.com> <831qkscgfv.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19233"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 To: Eli Zaretskii , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 10 11:06:56 2023 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1plnUF-0004lR-9v for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 10 Apr 2023 11:06:55 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1plnTl-00021p-Ls; Mon, 10 Apr 2023 05:06:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1plnTT-0001r4-W0 for help-gnu-emacs@gnu.org; Mon, 10 Apr 2023 05:06:10 -0400 Original-Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1plnTK-0005gg-Iz; Mon, 10 Apr 2023 05:06:02 -0400 Original-Received: by mail-pl1-x634.google.com with SMTP id ke16so4095461plb.6; Mon, 10 Apr 2023 02:05:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1681117549; x=1683709549; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=yahbwfUwmtWNurKl9Ct7pA7dVsbp4b750RY/vpkX53A=; b=gGd/X77fEvgDYQ/Jl4EoEXLcxYSnwZFKFHuxZpiV7zDovSRVJXS6eq9tkVsl4tWXk5 zsueXShZBwObf3bZAPI3ebuyj5JyXifs/M8cqabxWGndv7BSe+a4WH6VuSA/1f4cxXGL XDOCIWE9MS5RozUEPsE/rraWZs8xoz+PPUmL2JHCBuPmuCiViuuZ4rVPRLWLMxgK0fli oXpIujXsDLwksVj++I2CpmOt5E+qhXqybnrLezaOErpYZW1LgAf+abkYkjQP3P/8WRvh uEi+ey7wk5iNf/mW/85GXaYJ6psNTx2mVyiYTYhSDEsVeX1VkQ3AAYMW+8vwAX1POTvO OY1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681117549; x=1683709549; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yahbwfUwmtWNurKl9Ct7pA7dVsbp4b750RY/vpkX53A=; b=ykRa25uBCmzKq0i59QpylCbduqTMdT1Xrduj46PFFOvlHvovf5bglbDcq291Tnkb3U bDkiobg1xNosUAepvzo3oyrf7M7YW2ep99xUWsVIVzTjGqvMWqv7+h1SS9ISxOJQmy7a D5KaM1ReSCKmIAmgr9gB0mewMiWElxtfl2hMokXCGtx2pGKrO/Y2zNDOo9zNHrixgh0T OfUDnXKqzVUusqh+UpqVRxkpt92k1y1ngEJ73O5KcFhI9zmu9HDJEpIl2ZDllAtJifvl YKpjv8uMP0YMM7STZ3ozDN/egvFeY5vx4DGniN19EAMfT+8/8Aznr5923eojp8FN08+n 8eCg== X-Gm-Message-State: AAQBX9dw2RorU8nCSNo4xbQouOE8yGt5ES9DyC7OyzBjqmGLEi4SHXqm Bvhys9uRZtFJvEPXEtbKiMD7mXBKFAOqAQ== X-Google-Smtp-Source: AKy350Yx/OE+9/OfJbpg0K2qkuMZn6xuyPQgyaQVAnlspN3ZDRHsW/ASQXtm9dI0ShUy1CW/5f/LSQ== X-Received: by 2002:a17:903:64e:b0:1a1:c0e6:d8d6 with SMTP id kh14-20020a170903064e00b001a1c0e6d8d6mr10207810plb.54.1681117548529; Mon, 10 Apr 2023 02:05:48 -0700 (PDT) Original-Received: from [192.170.1.133] ([103.24.106.35]) by smtp.gmail.com with ESMTPSA id 3-20020a170902c20300b001a647709864sm874827pll.155.2023.04.10.02.05.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 Apr 2023 02:05:48 -0700 (PDT) Content-Language: en-US In-Reply-To: <831qkscgfv.fsf@gnu.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=platon7pronko@gmail.com; helo=mail-pl1-x634.google.com X-Spam_score_int: -49 X-Spam_score: -5.0 X-Spam_bar: ----- X-Spam_report: (-5.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, NICE_REPLY_A=-2.888, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:143249 Archived-At: 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