From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.bugs Subject: bug#61283: 29.0.60; pcomplete-completions-at-point loses text properties, breaking pcomplete-from-help annotations Date: Mon, 22 May 2023 21:16:59 -0700 Message-ID: References: <2eb987c6-0aec-55df-db4e-ef95557ab809@daniel-mendler.de> <83zg64zhyx.fsf@gnu.org> <31f17ffe-8070-4259-03d2-2c63e5cc5ee9@daniel-mendler.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------NgJ2b5Tutov0chumaikTXNP8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24961"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Daniel Mendler , Eli Zaretskii , liuhui1610@gmail.com, Augusto Stoffel , 61283@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 23 06:18:25 2023 Return-path: Envelope-to: geb-bug-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 1q1JTc-0006Ko-Fe for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 23 May 2023 06:18:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q1JTI-0001Oy-QK; Tue, 23 May 2023 00:18:04 -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 1q1JTG-0001Ni-Mv for bug-gnu-emacs@gnu.org; Tue, 23 May 2023 00:18:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q1JTG-00079A-Ez for bug-gnu-emacs@gnu.org; Tue, 23 May 2023 00:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q1JTF-0005J5-PE for bug-gnu-emacs@gnu.org; Tue, 23 May 2023 00:18:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 23 May 2023 04:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61283 X-GNU-PR-Package: emacs Original-Received: via spool by 61283-submit@debbugs.gnu.org id=B61283.168481543420326 (code B ref 61283); Tue, 23 May 2023 04:18:01 +0000 Original-Received: (at 61283) by debbugs.gnu.org; 23 May 2023 04:17:14 +0000 Original-Received: from localhost ([127.0.0.1]:37752 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q1JST-0005Hl-8B for submit@debbugs.gnu.org; Tue, 23 May 2023 00:17:14 -0400 Original-Received: from mail-pf1-f177.google.com ([209.85.210.177]:60655) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q1JSM-0005H9-Vf for 61283@debbugs.gnu.org; Tue, 23 May 2023 00:17:11 -0400 Original-Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-64d2c865e4eso3559964b3a.0 for <61283@debbugs.gnu.org>; Mon, 22 May 2023 21:17:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684815421; x=1687407421; h=in-reply-to:from:references:cc:to:content-language:subject :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=ZjCoWM0v2Oqbh9rUTfzHL2x7cPI3Q6v5lrrDBniI2lE=; b=Bg59J/LUKOUhiY6kknOZqL1tPwVujym20Oap/p22j6Ck8mHFhNcQP/Ji0yYM2RAtr4 m2gOhDF6bxwVnXk/WZcJr9qL9eGOGxhRqDfPDBiFjwMyIvmELEvqbWXiU/idDuOlvCJb 0nHLJvp/WUdqWpVSQrnw9Iaftu6ZXL4Cim37NlF8z5STKFdsAIstJ8/4tkr+P6CpDPdG T095YgJmjpNcSNFSKPmX8OVOEbD5oya1OcZ76ZElR0uciaMAbI6Vc7R2EswksCIrJqdB +V7yYaGRe4dfux7Is6U/1dxc9SdPj5D0ruv/JKavRNMUjAt5Fg7ieBaaTTyNAbkn2RNB czxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684815421; x=1687407421; h=in-reply-to:from:references:cc:to:content-language:subject :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=ZjCoWM0v2Oqbh9rUTfzHL2x7cPI3Q6v5lrrDBniI2lE=; b=HdqzE32IUNw/AswLL0EzsIP7kmwFv8t1K4wF+gcuMGHfGm8PnWCSbqeVve+neE3XqX zWRHI/uU1HFZOhpOmVALjQzF16ndETTBaFmrZPUT145IJtHWHS8iQAGquUb3G7CkEHAz akv+CogLuKzd9gpDTxZ9RLgvtms7X77Twpk1PiZathzvYvmW3O2Lv4Rgn3J14D0Zk/Ke TddnmAh8iIeSO5TfkVg9rHwRJ6fvp8Fe39j7vujGr7saZkQGjlon79fz79y1ZrMb2US3 ysvlTDq6/K7Z5mSXg1Mm+0Colk60k/dggIEX4KX5V4h9MvvChS5XmqccMu3aOAA7ThD7 Qtig== X-Gm-Message-State: AC+VfDwmJqunqid2Hy4L9rEwKr5zkuhlfLt4j4m6DaFWqZPf2x+1fSLy OC2r+Zd2CvOOAiuXDu0KYMU= X-Google-Smtp-Source: ACHHUZ5o1+NNA5IlYiOooiFZwtzwvG5bo5aSnwM0R1bhwBs+ohXRVs1JYhsW+LPdxqdJqUTVUwYd0w== X-Received: by 2002:a05:6a00:24d4:b0:64d:2c61:4b1 with SMTP id d20-20020a056a0024d400b0064d2c6104b1mr16577654pfv.11.1684815420793; Mon, 22 May 2023 21:17:00 -0700 (PDT) Original-Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id u10-20020a63140a000000b005344b30d449sm5037656pgl.86.2023.05.22.21.16.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 22 May 2023 21:17:00 -0700 (PDT) Content-Language: en-US In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:262202 Archived-At: This is a multi-part message in MIME format. --------------NgJ2b5Tutov0chumaikTXNP8 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 5/18/2023 6:30 AM, Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote: >> ... since getting a 100% reliable solution here might take quite a bit more >> work than I thought, how about a not-quite-100% hack? Instead of >> propertizing the first character of each candidate, propertize the *last* >> character (or the entire string?). That won't get thrown out quite >> so easily. > > I'll see your "last char" and raise you a "the whole string" (and then > use the property on the first char where it's found, using > `next-single-property-change`)? After thinking this over some more, how about a completely different strategy like the following? This uses a programmed completion function[1] to supply an annotation-function as appropriate. This also fixes a tangentially-related issue where long options that take an argument added an extraneous space after the trailing "=". (This bit is actually the original patch I was working on before discovering the issue described in this bug.) Pcomplete might have some issues with handling programmed completion functions like this, but I *think* it makes sense to go this route if possible: making Pcomplete work more like the rest of Emacs' completion code would be very nice. [1] "Programmed completion" vs "programmable completion (Pcomplete)": *that's* definitely not confusing at all. ;) --------------NgJ2b5Tutov0chumaikTXNP8 Content-Type: text/plain; charset=UTF-8; name="0001-WIP-Use-a-programmed-completion-function-to-handle-l.patch" Content-Disposition: attachment; filename*0="0001-WIP-Use-a-programmed-completion-function-to-handle-l.pa"; filename*1="tch" Content-Transfer-Encoding: base64 RnJvbSA0NGEwODMzZWUxODkxZWE4NDcyN2NhOTk0ZWNmYTFhMzRhNDlkNWUzIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBKaW0gUG9ydGVyIDxqcG9ydGVyYnVnc0BnbWFpbC5j b20+CkRhdGU6IEZyaSwgMTAgRmViIDIwMjMgMTM6NTI6MzMgLTA4MDAKU3ViamVjdDogW1BB VENIXSBXSVA6IFVzZSBhIHByb2dyYW1tZWQgY29tcGxldGlvbiBmdW5jdGlvbiB0byBoYW5k bGUgbG9uZwogb3B0aW9ucyBpbiBQY29tcGxldGUKClRoaXMgZG9lcyB0d28gdGhpbmdzOgoK MS4gV2hlbiBjb21wbGV0aW5nIGFuIG9wdGlvbiB0aGF0IHRha2VzIGFuIGFyZ3VtZW50IChp LmUuIGFuIG9wdGlvbgogICBzdHJpbmcgZW5kaW5nIGluICI9IiksIGRvbid0IGFkZCBhIHRy YWlsaW5nIHNwYWNlLiAgVGhlIHNwYWNlIGlzCiAgIHVuaGVscGZ1bCwgc2luY2UgdGhlIHVz ZXIgbGlrZWx5IHdhbnRzIHRvIGFkZCBhIHZhbHVlIGZvciB0aGF0CiAgIG9wdGlvbiBpbW1l ZGlhdGVseSBhZnRlciB0aGUgIj0iLgoKMi4gUmV0dXJuIGFuIGFwcHJvcHJpYXRlICdhbm5v dGF0aW9uLWZ1bmN0aW9uJyBmb3IgdGhlIG9wdGlvbiB0bwogICBoYW5kbGUgdGhlICdwY29t cGxldGUtYW5ub3RhdGlvbicgdGV4dCBwcm9wZXJ0eS4gIE1heWJlIHdlIHNob3VsZAogICBz dG9yZSB0aGUgYW5ub3RhdGlvbiBzb21ld2hlcmUgb3RoZXIgdGhhbiBhIHRleHQgcHJvcGVy dHksIGJ1dCB0aGlzCiAgIHdvcmtzIGFzIGEgcHJvb2Ygb2YgY29uY2VwdC4uLgotLS0KIGxp c3AvcGNtcGwtZ251LmVsIHwgIDMgKystCiBsaXNwL3Bjb21wbGV0ZS5lbCB8IDQxICsrKysr KysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKystCiAyIGZpbGVzIGNoYW5nZWQs IDQyIGluc2VydGlvbnMoKyksIDIgZGVsZXRpb25zKC0pCgpkaWZmIC0tZ2l0IGEvbGlzcC9w Y21wbC1nbnUuZWwgYi9saXNwL3BjbXBsLWdudS5lbAppbmRleCAxNTUzYzNlZmVkNy4uNDg4 YTA1MDFhNDggMTAwNjQ0Ci0tLSBhL2xpc3AvcGNtcGwtZ251LmVsCisrKyBiL2xpc3AvcGNt cGwtZ251LmVsCkBAIC0yNzQsNyArMjc0LDggQEAgcGNvbXBsZXRlL3RhcgogICAgICAgKGlm IChwY29tcGxldGUtbWF0Y2ggIl4tLSIgMCkKICAgICAgICAgICAoY29uZAogICAgICAgICAg ICAoKHBjb21wbGV0ZS1tYXRjaCAiXi0tXFwoW149IFx0XG5cZl0qXFwpXFwnIiAwKQotICAg ICAgICAgICAgKHBjb21wbGV0ZS1oZXJlKiBwY21wbC1nbnUtLXRhci1sb25nLW9wdGlvbnMp KQorICAgICAgICAgICAgKHBjb21wbGV0ZS1oZXJlKiAocGNvbXBsZXRlLWxvbmctb3B0aW9u LWNvbXBsZXRpb24tdGFibGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBjbXBs LWdudS0tdGFyLWxvbmctb3B0aW9ucykpKQogICAgICAgICAgICAoKHBjb21wbGV0ZS1tYXRj aCAiXFxgLS1kaXJlY3Rvcnk9XFwoLipcXCkiIDApCiAgICAgICAgICAgICAocGNvbXBsZXRl LWhlcmUqIChwY29tcGx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gICAgICAgICAgICAgICAgICAgICAgICAgICAgOyB0cnktY29t cGxldGlvbgorICAgICAgIChsZXQgKChyZXN1bHQgKHRyeS1jb21wbGV0aW9uIHN0cmluZyBv cHRpb25zIHByZWQpKSkKKyAgICAgICAgIDs7IElmIHRoZSBjb21wbGV0aW9uIGVuZHMgaW4g Ij0iLCB0aGVuIGl0J3Mgbm90IHJlYWxseQorICAgICAgICAgOzsgY29tcGxldGUgeWV0OiB3 ZSBleHBlY3QgYSB2YWx1ZSBhZnRlciB0aGUgIj0iLiAgUmV0dXJuIHRoZQorICAgICAgICAg Ozsgb3JpZ2luYWwgU1RSSU5HIGluIHRoaXMgY2FzZSBpbnN0ZWFkIG9mIHQgdG8gaW5kaWNh dGUKKyAgICAgICAgIDs7IHRoYXQuCisgICAgICAgICAoaWYgKGFuZCAoZXEgcmVzdWx0IHQp IChzdHJpbmctc3VmZml4LXAgIj0iIHN0cmluZykpCisgICAgICAgICAgICAgc3RyaW5nCisg ICAgICAgICAgIHJlc3VsdCkpKQorICAgICAgKCd0ICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgOyBhbGwtY29tcGxldGlvbnMKKyAgICAgICAoYWxsLWNvbXBsZXRpb25zIHN0 cmluZyBvcHRpb25zIHByZWQpKQorICAgICAgKCdsYW1iZGEgICAgICAgICAgICAgICAgICAg ICAgICAgICAgOyB0ZXN0LWNvbXBsZXRpb24KKyAgICAgICAgKGxldCAoKHJlc3VsdCAodGVz dC1jb21wbGV0aW9uIHN0cmluZyBvcHRpb25zIHByZWQpKSkKKyAgICAgICAgICAoaWYgKGFu ZCAoZXEgcmVzdWx0IHQpIChzdHJpbmctc3VmZml4LXAgIj0iIHN0cmluZykpCisgICAgICAg ICAgICAgIHN0cmluZworICAgICAgICAgICAgcmVzdWx0KSkpCisgICAgICAoJ21ldGFkYXRh CisgICAgICAgOzsgRklYTUU6IFRoZXJlJ3MgcHJvYmFibHkgYSBjbGVhbmVyIHdheSB0byBk byB0aGlzIGlmIHdlCisgICAgICAgOzsgY2hhbmdlIGhvdyBPUFRJT05TIGlzIHN0cnVjdHVy ZWQuICBXZSBzaG91bGQgYWxzbyBzdXBwb3J0CisgICAgICAgOzsgaGVscCB0ZXh0LgorICAg ICAgIGAobWV0YWRhdGEgKGFubm90YXRpb24tZnVuY3Rpb24KKyAgICAgICAgICAgICAgICAg ICAuICwobGFtYmRhIChzKQorICAgICAgICAgICAgICAgICAgICAgICAgKGdldC10ZXh0LXBy b3BlcnR5CisgICAgICAgICAgICAgICAgICAgICAgICAgMCAncGNvbXBsZXRlLWFubm90YXRp b24KKyAgICAgICAgICAgICAgICAgICAgICAgICAoc2VxLWZpbmQgKGxhbWJkYSAoY2FuZCkg KHN0cmluZz0gcyBjYW5kKSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg b3B0aW9ucykpKSkpKQorICAgICAgKGAoYm91bmRhcmllcyAuICxfc3VmZml4KQorICAgICAg IDs7IEZJWE1FOiBJbXBsZW1lbnQgYm91bmRhcmllcy4KKyAgICAgICAnKGJvdW5kYXJpZXMg MCAuIDApKSkpKQorCiA7OzsgUGFyc2luZyBoZWxwIG1lc3NhZ2VzCiAKIChkZWZ2YXIgcGNv bXBsZXRlLWZyb20taGVscCAobWFrZS1oYXNoLXRhYmxlIDp0ZXN0ICMnZXF1YWwpCkBAIC0x NDk1LDcgKzE1MzMsOCBAQCBwY29tcGxldGUtaGVyZS11c2luZy1oZWxwCiAgICAgICAgICAg IChwY29tcGxldGUtaGVyZSAocGNvbXBsZXRlLWVudHJpZXMpCiAgICAgICAgICAgICAgICAg ICAgICAgICAgICAocGNvbXBsZXRlLW1hdGNoLXN0cmluZyAxIDApKSkKICAgICAgICAgICAo KHN0cmluZy1wcmVmaXgtcCAiLSIgKHBjb21wbGV0ZS1hcmcgMCkpCi0gICAgICAgICAgIChw Y29tcGxldGUtaGVyZSAoYXBwbHkgIydwY29tcGxldGUtZnJvbS1oZWxwIGNvbW1hbmQgYXJn cykpKQorICAgICAgICAgICAocGNvbXBsZXRlLWhlcmUgKHBjb21wbGV0ZS1sb25nLW9wdGlv bi1jb21wbGV0aW9uLXRhYmxlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGFwcGx5 ICMncGNvbXBsZXRlLWZyb20taGVscCBjb21tYW5kIGFyZ3MpKSkpCiAgICAgICAgICAgKHQg KHBjb21wbGV0ZS1oZXJlKiAocGNvbXBsZXRlLWVudHJpZXMpKSkpKSkKIAogKHByb3ZpZGUg J3Bjb21wbGV0ZSkKLS0gCjIuMjUuMQoK --------------NgJ2b5Tutov0chumaikTXNP8--