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#59956: 29.0.60: Failure when completing arguments in Eshell after variable interpolation Date: Mon, 19 Dec 2022 15:00:55 +0000 Message-ID: References: <83iliiv0yv.fsf@gnu.org> <765547c0-b2a5-b054-a29d-b27002b7442c@gmail.com> <07bcf6a532d0428b9f53@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="676"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Jim Porter , Eli Zaretskii , arstoffel@gmail.com, 59956@debbugs.gnu.org, John Wiegley To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 19 16:01:29 2022 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 1p7Hdx-000AYe-Ec for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 19 Dec 2022 16:01:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7Hdd-0006bo-2a; Mon, 19 Dec 2022 10:01:09 -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 1p7HdY-0006Zd-DP for bug-gnu-emacs@gnu.org; Mon, 19 Dec 2022 10:01:05 -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 1p7HdW-0006tt-Cb for bug-gnu-emacs@gnu.org; Mon, 19 Dec 2022 10:01:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p7HdW-0003MS-1Z for bug-gnu-emacs@gnu.org; Mon, 19 Dec 2022 10:01:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Gregory Heytings Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 19 Dec 2022 15:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59956 X-GNU-PR-Package: emacs Original-Received: via spool by 59956-submit@debbugs.gnu.org id=B59956.167146205912907 (code B ref 59956); Mon, 19 Dec 2022 15:01:02 +0000 Original-Received: (at 59956) by debbugs.gnu.org; 19 Dec 2022 15:00:59 +0000 Original-Received: from localhost ([127.0.0.1]:38645 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7HdS-0003M7-V5 for submit@debbugs.gnu.org; Mon, 19 Dec 2022 10:00:59 -0500 Original-Received: from heytings.org ([95.142.160.155]:36946) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7HdR-0003M1-1a for 59956@debbugs.gnu.org; Mon, 19 Dec 2022 10:00:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1671462055; bh=NwLCvYggxQnaNMLlMHLJwCqd/u1NXKxEdasJhyNUklI=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=JzEXDjiMKKsCkf3O+qpXV7svtqhB373dtxqqp7VB0tJUkiDakXRYnKFB3UQgkTnb1 Uibphcx0jSJ4AvkvwycesaGjnVuy8gr97V8UT6Xlo0jGnLEr7Q1ZjAuz0r3gvnpBNi TWWsdCI/X1IgeM4KPh2zVMt7bw2hBJLJzOrjdn2rDGCZLPjvvTMwwY6f9hsScZTndk nC2MkjILNqPVAsK57V/SKRJy6gSTUgOWYIiryDxaxBQIf+7+t37d7mCPH/boOiqGE/ Hv0f6MrNC30pVfx6pgOF8Ao3hWbkw4qRHBk7RVgoeAQSCa7C+rIG1fC/eDHhUr1OVH xMNqI1Xrl7/6Q== 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:251436 Archived-At: > > The more I think about it, the more my workaround sounds appealing. > What do you think of this (based on Augusto's suggestion)? It seems to me that it's a more elegant workaround, with which further improvements become possible, which isn't the case if we squeeze the value into a string. diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el index 4e3a88bbda8..2a2bbf114e0 100644 --- a/lisp/pcomplete.el +++ b/lisp/pcomplete.el @@ -645,13 +645,25 @@ pcomplete-arg The OFFSET argument is added to/taken away from the index that will be used. This is really only useful with `first' and `last', for -accessing absolute argument positions." - (nth (+ (pcase index - ('first 0) - ('last pcomplete-last) - (_ (- pcomplete-index (or index 0)))) - (or offset 0)) - pcomplete-args)) +accessing absolute argument positions. + +When the INDEXth argument has been transformed into something +that is not a string by `pcomplete-parse-arguments-function', the +text representation of the argument is returned, and its value is +stored in its pcomplete-arg-value text property." + (let ((arg + (nth (+ (pcase index + ('first 0) + ('last pcomplete-last) + (_ (- pcomplete-index (or index 0)))) + (or offset 0)) + pcomplete-args))) + (if (stringp arg) + arg + (propertize + (buffer-substring (pcomplete-begin index offset) + (pcomplete-begin (1- (or index 0)) offset)) + 'pcomplete-arg-value arg)))) (defun pcomplete-begin (&optional index offset) "Return the beginning position of the INDEXth argument.