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#67112: 30.0.50; [PATCH] Fix completion annotations when using 'pcomplete-here-using-help' Date: Sat, 11 Nov 2023 13:43:04 -0800 Message-ID: <6955475e-3ea7-f6a9-bc99-58420b7ba2f5@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------K0AhIgCWvR0puUwUlGV6kcRc" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40833"; mail-complaints-to="usenet@ciao.gmane.io" Cc: monnier@iro.umontreal.ca To: 67112@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 11 22:43:45 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 1r1vlY-000ATe-V8 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 11 Nov 2023 22:43:45 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r1vlD-00050h-H1; Sat, 11 Nov 2023 16:43:23 -0500 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 1r1vlC-00050Y-Mc for bug-gnu-emacs@gnu.org; Sat, 11 Nov 2023 16:43:22 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r1vlC-0006w2-EG for bug-gnu-emacs@gnu.org; Sat, 11 Nov 2023 16:43:22 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r1vlq-0008Sr-AK; Sat, 11 Nov 2023 16:44:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: monnier@iro.umontreal.ca, bug-gnu-emacs@gnu.org Resent-Date: Sat, 11 Nov 2023 21:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 67112 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: monnier@iro.umontreal.ca Original-Received: via spool by submit@debbugs.gnu.org id=B.169973903832515 (code B ref -1); Sat, 11 Nov 2023 21:44:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 11 Nov 2023 21:43:58 +0000 Original-Received: from localhost ([127.0.0.1]:54497 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r1vlm-0008SM-1f for submit@debbugs.gnu.org; Sat, 11 Nov 2023 16:43:58 -0500 Original-Received: from lists.gnu.org ([2001:470:142::17]:55212) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r1vlj-0008S7-NT for submit@debbugs.gnu.org; Sat, 11 Nov 2023 16:43:56 -0500 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 1r1vkz-0004zz-Kl for bug-gnu-emacs@gnu.org; Sat, 11 Nov 2023 16:43:09 -0500 Original-Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r1vkx-0006us-Sl for bug-gnu-emacs@gnu.org; Sat, 11 Nov 2023 16:43:09 -0500 Original-Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6c4eaa5202aso1567389b3a.1 for ; Sat, 11 Nov 2023 13:43:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699738986; x=1700343786; darn=gnu.org; h=subject:from:to:content-language:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=lWoWH9tZsYQQ46+XyC+8IE3Qyp2PZmk42tXLx+9kEss=; b=lgGkvAjW/5fKQp1xB0jnwHrR682axbUSAg8AoZZLTUTrTjFhu76vReoQa5xLvn8AJj 7u7H/kwdB66Vab6sweRjJBA7KOLG9WYL69QOz5rby3rXQai1LhW3N4O+bNkU1dCfDWKz ugLLGlal59ZzULLZUSVFUWaXxabZ1sdLAyxRZRTvjdQYu1xg7/tt9/OugHNMa5UIE2qu a4PT0+TUhVx6Jk+VAxtnxaw3FULwiqtNtXcmjxMyzWOeZOw2WVNbOMtlh0pkO6pPQSfL OPKYYEOvJUQC6p3D9EwKS5/7liQX1nP0OmFQO1ibaTexOT9L11RqIoOD57O7wBtFe+1F aw1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699738986; x=1700343786; h=subject:from:to:content-language:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lWoWH9tZsYQQ46+XyC+8IE3Qyp2PZmk42tXLx+9kEss=; b=UQBxNXspXgd1kvuagJ7VerrEGVuCBSCa48p46wTVbBPeodRCOTjNO1Tvf6eqekY35p 6/bRnz+ltMyf2A8qxpbWztbz14EQWkdCXEwbk5qA9dP8aOBrz4tv0MCoCe4rzHbY6jy4 tus+wePo9q7U5tLsICvnYYNzYrxsgScfIARzbK4H7W52CAFicaYMRnFvUqOgvcjMsr21 x9Geg8Fe0H2hiPKyQfHQdOjf9YFdN/LTBBiGPrautobmMwxNARy6s+UNWaMGS7eBK8Rn 5Yj54y16QBtpyqeVkm5b2F73NyE8ZYBTm6Gwo/Y8lXYtoU8yyq0lzmvvH4dp29WlIdFl TjaQ== X-Gm-Message-State: AOJu0YxJF3RRizK2QPQKpq65u3mLAzWAvBVoid22PPpeJiXLmYtCOuXu I3xhi4Nfs/7IlxVufgIo6s7U224IjWA= X-Google-Smtp-Source: AGHT+IHhgRdE86OfGfXnpazz3Sdzsw21yHwcuHCd9M1nTjCwmlwcByiZX+LSygISn2L1ffah2bp5Hw== X-Received: by 2002:a05:6a00:44cd:b0:6c4:22be:c5ad with SMTP id cv13-20020a056a0044cd00b006c422bec5admr3637250pfb.31.1699738986251; Sat, 11 Nov 2023 13:43:06 -0800 (PST) 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 d3-20020aa78683000000b0069343e474bcsm1668668pfo.104.2023.11.11.13.43.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 11 Nov 2023 13:43:05 -0800 (PST) X-Mozilla-News-Host: news://news.gmane.io:119 Content-Language: en-US Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=jporterbugs@gmail.com; helo=mail-pf1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:274173 Archived-At: This is a multi-part message in MIME format. --------------K0AhIgCWvR0puUwUlGV6kcRc Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Debbugs-Cc: monnier@iro.umontreal.ca Starting from "emacs -Q -f shell" (or eshell, doesn't matter) on a GNU/Linux system, type "cp -" and then press TAB. The completions buffer shows a list of completions. However, they don't show the annotations, which in this case should be a helpful string for any option taking an argument. For example, one completion is "--backup". This takes an optional "CONTROL" argument, which should show in the completions list. However, it doesn't. With the attached patch, the completions list now correctly shows "--backup[=CONTROL]". This was happening because 'pcomplete-here-using-help' passes along the annotation as a text property on the first character of each completion candidate. That property failed to propagate through 'completion-table-with-quoting' though. So the fix is to propagate text properties on the first character of the candidate, since that's already a convention in a couple places with completion tables. (There's a larger question about whether 'pcomplete-here-using-help' is doing this in the right way. Maybe instead of returning a list of candidates with text properties for annotations and such, it should instead return a programmed completion table that specifies an 'annotation-function' for the table's metadata. However, that's both a much more invasive change, and I think we'd still want this patch to help improve other parts of completion tables. For example, with this patch, 'completion-table-merge' could annotate which table each candidate is from, and then we could resolve the FIXME in that function.) --------------K0AhIgCWvR0puUwUlGV6kcRc Content-Type: text/plain; charset=UTF-8; name="0001-Forward-completion-text-properties-when-using-comple.patch" Content-Disposition: attachment; filename*0="0001-Forward-completion-text-properties-when-using-comple.pa"; filename*1="tch" Content-Transfer-Encoding: base64 RnJvbSBiNGNiNDkyZWJlNGM3OTA1YjgzYmZiY2Q4MWU2YmM4Mzg1ZDBhNzYwIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBKaW0gUG9ydGVyIDxqcG9ydGVyYnVnc0BnbWFpbC5j b20+CkRhdGU6IFNhdCwgMTEgTm92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pKSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAocWNvbXBs ZXRpb24gKGNvbmNhdCBxcHJlZml4IHFuZXcpKSkKKyAgICAgICAgICAgICAgICAgICA7OyBT b21lIGNvbXBsZXRpb24gdGFibGVzIChpbmNsdWRpbmcgdGhpcyBvbmUpIHBhc3MKKyAgICAg ICAgICAgICAgICAgICA7OyBhbG9uZyBuZWNlc3NhcnkgaW5mb3JtYXRpb24gYXMgdGV4dCBw cm9wZXJ0aWVzCisgICAgICAgICAgICAgICAgICAgOzsgb24gdGhlIGZpcnN0IGNoYXJhY3Rl ciBvZiB0aGUgY29tcGxldGlvbi4gIE1ha2UKKyAgICAgICAgICAgICAgICAgICA7OyBzdXJl IHRoZSBxdW90ZWQgY29tcGxldGlvbiBoYXMgdGhlc2UgcHJvcGVydGllcworICAgICAgICAg ICAgICAgICAgIDs7IHRvby4KKyAgICAgICAgICAgICAgICAgICAoYWRkLXRleHQtcHJvcGVy dGllcyAwIDEgKHRleHQtcHJvcGVydGllcy1hdCAwIGNvbXBsZXRpb24pCisgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcWNvbXBsZXRpb24pCiAgICAgICAgICAg ICAgICAgICAgOzsgQXR0YWNoIHVucXVvdGVkIGNvbXBsZXRpb24gc3RyaW5nLCB3aGljaCBp cyBuZWVkZWQKICAgICAgICAgICAgICAgICAgICA7OyB0byBzY29yZSB0aGUgY29tcGxldGlv biBpbiBgY29tcGxldGlvbi0tZmxleC1zY29yZScuCiAgICAgICAgICAgICAgICAgICAgKHB1 dC10ZXh0LXByb3BlcnR5IDAgMSAnY29tcGxldGlvbi0tdW5xdW90ZWQKLS0gCjIuMjUuMQoK --------------K0AhIgCWvR0puUwUlGV6kcRc--