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: Thu, 18 May 2023 00:11:09 -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: 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="10556"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Daniel Mendler , Eli Zaretskii , 61283@debbugs.gnu.org, Augusto Stoffel , liuhui1610@gmail.com To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 18 09:12:22 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 1pzXoC-0002Xq-Tl for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 18 May 2023 09:12:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pzXnv-0001nh-SP; Thu, 18 May 2023 03:12:03 -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 1pzXnu-0001nF-QK for bug-gnu-emacs@gnu.org; Thu, 18 May 2023 03:12: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 1pzXnu-0006rM-IS for bug-gnu-emacs@gnu.org; Thu, 18 May 2023 03:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pzXnu-0008Ql-Cq for bug-gnu-emacs@gnu.org; Thu, 18 May 2023 03:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 18 May 2023 07:12:02 +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.168439388032343 (code B ref 61283); Thu, 18 May 2023 07:12:02 +0000 Original-Received: (at 61283) by debbugs.gnu.org; 18 May 2023 07:11:20 +0000 Original-Received: from localhost ([127.0.0.1]:51836 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pzXnD-0008Pa-Ux for submit@debbugs.gnu.org; Thu, 18 May 2023 03:11:20 -0400 Original-Received: from mail-pj1-f54.google.com ([209.85.216.54]:62685) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pzXnB-0008PN-US for 61283@debbugs.gnu.org; Thu, 18 May 2023 03:11:18 -0400 Original-Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-2532d6c7ef2so675294a91.0 for <61283@debbugs.gnu.org>; Thu, 18 May 2023 00:11:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684393872; x=1686985872; h=content-transfer-encoding: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=U9ZLZJazguZsvzJi1yVW4lb9qJhssRc3lBVJri3kEr0=; b=r1jG5nY+Iv8dxtqzQLFwSs0WgIFlhNxX0dl8E4CJJ/WOav7ie+kSja2VWY8Ou7Ho/p l+z7MHpXl5L9cWqbfmazfXftMCO0BdpFzWovsEEAfhCkjvHH+TjPCKpfkgqCeQ6ztHOU dxfWHnfJIoADMoV4UktCu6vYixf4kglCBlGyhvPdyJPFpGce6LBeRFRrzEAov40d6a9X ME1hx0uDX6oEu8ege/eo7+ixR87i5g2yoTlqUOXXnC0us4CqDi8iCQ7jbqKPTWGRip3E BbKc9Jg+ElMu1vqUhG668n12DzKt6BLV7oRLqtsBHrrvMEkwkv2NvxcszcLrfXurc7dv /xxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684393872; x=1686985872; h=content-transfer-encoding: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=U9ZLZJazguZsvzJi1yVW4lb9qJhssRc3lBVJri3kEr0=; b=CYxPf0FGT5LHwHx4e0sIpLdf3LrETbqF/ecSyx09X5r3CTCFlpUmieLMhp7VMpTLc/ PlCG+G+qSgOO0gYG4vUhunvtC8y3h5PLqMFNkgYnk57EDpDIF55c7AeUW84m+UvSEyQw YEN7vAWWvUkJW98SrfxevP6MJFWYi/g2fI/J1RH5f7Go5hOLdhSQqHrUUsXb/6kUkORk cgTIfW2TqKeouPitq+GY2e1zL5cdPDxs39hIyufRQPT/Shpb6/42Cu4Dw4UWghAJYJpM yU65rmYSFJloi2W2Yk9fZqX4vq+NA8Lgb23idGVg3s4Q+wYMjZXGk4Aqr0geR70uGZC5 rBtg== X-Gm-Message-State: AC+VfDxsvA4KdZwVi0yMQIJOh+z5ybNzHDxAubaQquHdpRY2pp4Yz7NK pS0uSIOlUcQxYYD86o3/kzo= X-Google-Smtp-Source: ACHHUZ4VrnKqjdNl61jV6npbKQ8X4noXRISECmaZhPjf4QmQBui+w0tY14zOwox0ZJDsRTEYoUsJ9w== X-Received: by 2002:a17:90b:3e8d:b0:253:4b01:30d with SMTP id rj13-20020a17090b3e8d00b002534b01030dmr1554941pjb.11.1684393871997; Thu, 18 May 2023 00:11:11 -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 s1-20020a17090aa10100b00247164c1947sm4741787pjp.0.2023.05.18.00.11.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 May 2023 00:11:11 -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:261905 Archived-At: On 5/17/2023 2:20 PM, Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote: > I think the crux of the problem is in: > > :annotation-function > (lambda (cand) > (when (stringp cand) > (get-text-property 0 'pcomplete-annotation cand))) > :company-docsig > (lambda (cand) > (when (stringp cand) > (get-text-property 0 'pcomplete-help cand))) > > Rather than fetch the info directly from `cand`, we should maybe > lookup the info from elsewhere (maybe `completions`?). Yeah, that's what my patch does. > Then again, I'm not sure how much `cand` can differ from the matching > entry in `completions`: it's affected by `completion-table-subvert` and > `completion-table-with-quoting` so in general it can be non-trivial to > figure out which entry of `completions` corresponds to the `cand` we > got :-( Hmm, yeah. That would be pretty tricky to get working 100% reliably. Like Daniel mentions, I think this doesn't come up (often?) for the specific case in this bug, but a fully-robust solution would be ideal. Maybe the 'metadata' operation[1] would be usable for this with some extra work. I'll have to think about this... ... 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. [1] https://www.gnu.org/software/emacs/manual/html_node/elisp/Programmed-Completion.html