From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last Date: Wed, 04 Jan 2023 10:56:26 -0500 Message-ID: References: <87358u5y6l.fsf@daniel-mendler.de> <226b32f79f2d431d75b6@heytings.org> <009141ba-c21a-a5cb-a81b-c72a12a26207@daniel-mendler.de> <226b32f79f728e6bfed4@heytings.org> <82cf05e4-3c3f-9804-4801-eb31988f6d7d@daniel-mendler.de> <226b32f79f325daf9c7a@heytings.org> <226b32f79fe1e154cfb4@heytings.org> <1de8c8ce-4aa1-c6e4-1ede-0acafc620a50@gmail.com> <3a2a25bc-9b15-cdc9-ace2-b859f71b5e71@daniel-mendler.de> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26623"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Daniel Mendler , Eli Zaretskii , 60464@debbugs.gnu.org, Jim Porter To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 04 16:57:10 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 1pD68b-0006dx-B6 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 04 Jan 2023 16:57:09 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pD68V-000629-UH; Wed, 04 Jan 2023 10:57:03 -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 1pD68U-00061o-Hu for bug-gnu-emacs@gnu.org; Wed, 04 Jan 2023 10:57:02 -0500 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 1pD68U-00085I-9p for bug-gnu-emacs@gnu.org; Wed, 04 Jan 2023 10:57:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pD68T-00085g-U3 for bug-gnu-emacs@gnu.org; Wed, 04 Jan 2023 10:57:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 04 Jan 2023 15:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60464 X-GNU-PR-Package: emacs Original-Received: via spool by 60464-submit@debbugs.gnu.org id=B60464.167284779631039 (code B ref 60464); Wed, 04 Jan 2023 15:57:01 +0000 Original-Received: (at 60464) by debbugs.gnu.org; 4 Jan 2023 15:56:36 +0000 Original-Received: from localhost ([127.0.0.1]:49386 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pD684-00084W-2Z for submit@debbugs.gnu.org; Wed, 04 Jan 2023 10:56:36 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:19725) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pD683-00084I-3o for 60464@debbugs.gnu.org; Wed, 04 Jan 2023 10:56:35 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 9E3D8441108; Wed, 4 Jan 2023 10:56:29 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id B9F9544109B; Wed, 4 Jan 2023 10:56:27 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1672847787; bh=Iv9rZb2eJBkM9+Og9+mDPsXhp9rVH9S8JE0UkuB9tCc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=OiSWX9G3YJvBdwFzJuHhbqrtoYxItxPZgzaNKWYX6Y2Enavc5OqV/lS8NNF2coe4G WYVP3HqDY0Viv1nPoTtjjBoBywLXsIU1NVF1/NH4IZZZQzdXKNEjeBjITPY+zZHApp JSFOYbnEiWbqr8jrevZv/WtmyqCRRNlZmrwOu913S9Cx16uOcJgkv+Cbq7yghzsLLM xd0FReYq1j5ajlpkBhvwhtVgIxSOgQQp5xwjn97O4NHe19Q69cBXsFCIg5OxPcYgC9 O74+GRAw5lbnK/7dAxp+9lhFnBSGVBMi6JWfx812I/RiDSnr4tvhroJZaQNg6HP5LZ zCNAAhSPep4Vg== Original-Received: from pastel (unknown [45.72.200.228]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 88FF01200FC; Wed, 4 Jan 2023 10:56:27 -0500 (EST) In-Reply-To: (Gregory Heytings's message of "Wed, 04 Jan 2023 15:39:26 +0000") 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:252499 Archived-At: Gregory Heytings [2023-01-04 15:39:26] wrote: >> Your implementation with the 'last condition doesn't make sense. > Can you please try to make it fail? >> It is not a good idea to treat 'last specially such that we return a >> different type in this case. > I'm not the one who wrote that code. According to my analysis of the code, > the only place where pcomplete-arg is called with a 'last' argument is > pcomplete-parse-arguments, where you will see the following: > > (defun pcomplete-parse-arguments (&optional expand-p) > ... > (let ((results (funcall pcomplete-parse-arguments-function))) > (when results > (setq ... > pcomplete-stub (pcomplete-arg 'last)) > (let ... > (if (and (listp pcomplete-stub) ;?? > (not pcomplete-expand-only-p)) > ;; If `pcomplete-stub' is a list, it means it's a list of > ;; completions computed during parsing, e.g. Eshell uses > ;; that to turn globs into lists of completions. That's also my understanding. So I think The Right Fix (or at least The Better Fix) is to pay no special attention to `last` in `pcomplete-arg` and instead in the above code of `pcomplete-parse-arguments` to look for the `pcomplete-arg-value` property. Maybe for `emacs-29` we can use your patch (with a comment about why `last` is handled specially pointing to its handling in `pcomplete-parse-arguments`) and then in `master` we remove this special handling of `last`? Stefan