From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings Newsgroups: gmane.emacs.bugs Subject: bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last Date: Sun, 01 Jan 2023 19:13:18 +0000 Message-ID: <226b32f79f028016490a@heytings.org> 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> <226b32f79f056489e881@heytings.org> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39342"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Daniel Mendler , Eli Zaretskii , 60464@debbugs.gnu.org, Jim Porter To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 01 20:14:23 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 1pC3mo-0009x1-FR for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 01 Jan 2023 20:14:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pC3mW-0008Dv-5j; Sun, 01 Jan 2023 14:14:04 -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 1pC3mU-0008CE-NL for bug-gnu-emacs@gnu.org; Sun, 01 Jan 2023 14:14: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 1pC3mU-0001pt-2i for bug-gnu-emacs@gnu.org; Sun, 01 Jan 2023 14:14:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pC3mT-0006oK-KU for bug-gnu-emacs@gnu.org; Sun, 01 Jan 2023 14:14:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Gregory Heytings Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Jan 2023 19:14: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.167260040126122 (code B ref 60464); Sun, 01 Jan 2023 19:14:01 +0000 Original-Received: (at 60464) by debbugs.gnu.org; 1 Jan 2023 19:13:21 +0000 Original-Received: from localhost ([127.0.0.1]:41776 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pC3lo-0006nG-Mo for submit@debbugs.gnu.org; Sun, 01 Jan 2023 14:13:20 -0500 Original-Received: from heytings.org ([95.142.160.155]:54824) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pC3ln-0006n8-6M for 60464@debbugs.gnu.org; Sun, 01 Jan 2023 14:13:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1672600398; bh=2bg9mQRArR/u8AFMlUX0X+vwxJTytCXr6UhtDgj2/Wk=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=T6HdaqL+CqisGN9wYelHKYNGR2usiee1dpRU7JHk9grKZQb3PIFlrmdODskLX59uy wkXBMoKYP6hIC6R74sKT7zkXno9xOMTApw+iOdzAaXhMrbXt0/HSoRkUt7Tt1M5hEJ 7JAtCz/PO6LUABBS0/tetio1Gw+JLzRvfQrd/W2vVRAx8x2b7iJWK/1LN/nhNf3519 kWip3IZUh3j4QVjN2BhMSvsP4cFT3SXwhiLuGcn5gUPmFmzg6mqdf5Bpsqe6ZGyId+ qWvLCl6VDYG1j6vi6lsFAXxGFe7oS5rJmHz+cLgq7pmNSOn3+9a8M0ecponoJsvAEa 0Lh2yElmJFxXg== 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:252279 Archived-At: >> (_ (- pcomplete-index (or index 0)))) >> (or offset 0)) >> pcomplete-args))) >> - (if (stringp arg) >> + (if (or (stringp arg) >> + (eq index 'last)) >> arg >> (propertize >> - (buffer-substring (pcomplete-begin index offset) >> - (pcomplete-begin (1- (or index 0)) offset)) >> + (car (split-string (pcomplete-actual-arg index offset))) >> 'pcomplete-arg-value arg)))) > > I'm not sure what specific problem this is trying to solve (is it the > choice of the "index" or is it the precise buffer positions of the > bounds)? > I admit I don't understand your question. It tries to use pcomplete-actual-arg, which uses buffer-substring, to get the text representation of the argument. It's not guaranteed to work in all cases, though, because it simply assumes that arguments are separated by spaces. But it should be "good enough". The (eq index 'last) means that when index is 'last we return the argument, even when it is not a string (or more precisely: when it is a list of strings, and the code assumes that a non-string arg is a list of string), because that's in fact what the caller expects (or at least that's what Eshell expects) in that case: that list is displayed in *Completions*.