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#59956: 29.0.60: Failure when completing arguments in Eshell after variable interpolation Date: Fri, 16 Dec 2022 09:13:09 -0500 Message-ID: References: <83iliiv0yv.fsf@gnu.org> <765547c0-b2a5-b054-a29d-b27002b7442c@gmail.com> 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="23739"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: John Wiegley , Gregory Heytings , arstoffel@gmail.com, Eli Zaretskii , 59956@debbugs.gnu.org To: Jim Porter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 16 15:14:16 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 1p6BTb-00060W-MA for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 16 Dec 2022 15:14:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p6BTQ-0003Yl-U4; Fri, 16 Dec 2022 09: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 1p6BTP-0003YN-94 for bug-gnu-emacs@gnu.org; Fri, 16 Dec 2022 09:14:03 -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 1p6BTO-0005TJ-D6 for bug-gnu-emacs@gnu.org; Fri, 16 Dec 2022 09:14:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p6BTO-00064u-8e for bug-gnu-emacs@gnu.org; Fri, 16 Dec 2022 09:14:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 16 Dec 2022 14:14: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.167120000423335 (code B ref 59956); Fri, 16 Dec 2022 14:14:02 +0000 Original-Received: (at 59956) by debbugs.gnu.org; 16 Dec 2022 14:13:24 +0000 Original-Received: from localhost ([127.0.0.1]:49583 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6BSl-00064J-TF for submit@debbugs.gnu.org; Fri, 16 Dec 2022 09:13:24 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:25107) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6BSg-000647-I1 for 59956@debbugs.gnu.org; Fri, 16 Dec 2022 09:13:22 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id CE0391002B1; Fri, 16 Dec 2022 09:13:12 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 4D32D10011C; Fri, 16 Dec 2022 09:13:11 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1671199991; bh=OmiwEKsxz/I/SbqG3XMPzZpePL0+mAvByfj+8qQLF/A=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=kNugJiROzx0ygG91Lcda+emeIkKCuc6F4Mr4ZblONgrJMClEKllxNtZswzrpmtoxl z92DAtN1S5TK11ft+tQlt98vW05isrDQVmRQoNAY2ubAVdnF5rhNTuDQD6DtiLnWO6 ihvNwDqd6kyHKqi2GpkU/UOXaXP5jq8qj7t4s4FWxQ1A2EaYOzEs3pTeAPDSsLPPC3 Z/Fz1W7jTdqlRdDLTRozE/0HTjQFMzkwpa4fl0esNh7ZWigxq6QblnV9V1KCFSC8wZ rjJPnbdEeQvbKXV4/l2rMhOZi2jHwFVyLlmpYBXt+lsTZeqY/E915JiQGrYALxGwJS WssUyL2Vf8G6A== Original-Received: from pastel (unknown [45.72.193.52]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 16263120F3D; Fri, 16 Dec 2022 09:13:11 -0500 (EST) In-Reply-To: <765547c0-b2a5-b054-a29d-b27002b7442c@gmail.com> (Jim Porter's message of "Thu, 15 Dec 2022 22:09:10 -0800") 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:251204 Archived-At: > Still, like Stefan and Augusto mentioned, there's probably a larger issue > here: should Eshell be allowed to feed Pcomplete non-strings? Since > Pcomplete was written for Eshell initially, there's some basis for why it > *might* support non-string values, but actually requiring that is an awful > lot to ask of every programmer who ever wants to write a pcomplete function. A "general" solution might be the one below, tho it looks more like a general workaround, I think. John? Stefan diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el index 4e3a88bbda8..6a4d754b8c0 100644 --- a/lisp/pcomplete.el +++ b/lisp/pcomplete.el @@ -646,12 +646,14 @@ 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)) + (let ((arg (nth (+ (pcase index + ('first 0) + ('last pcomplete-last) + (_ (- pcomplete-index (or index 0)))) + (or offset 0)) + pcomplete-args))) + (when arg + (if (stringp arg) arg (format "%S" arg))))) (defun pcomplete-begin (&optional index offset) "Return the beginning position of the INDEXth argument.