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#50470: 27.1; 'company-mode' 'eshell' Date: Thu, 16 Mar 2023 23:26:44 -0700 Message-ID: <00ad5c72-20c5-d27e-2bc8-6436858bbd8d@gmail.com> References: <87h7evegav.fsf@debian-BULLSEYE-live-builder-AMD64> <154bd0e9-2779-5a28-5587-a845a982e39f@yandex.ru> <815516d6-262b-4ef1-786e-ec5b4199847c@yandex.ru> <01845bee-7637-76f6-2e86-2e2de91f6f6e@yandex.ru> <0e8cc089-63ae-71b5-9617-ce76478d3ba4@yandex.ru> <602e2d92-7914-0e2b-b06e-0d47d0ac8c99@yandex.ru> <20ee85be-aafc-8942-14ea-b0c2a1abc2c9@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2591"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Christophe , 50470@debbugs.gnu.org, John Wiegley To: Dmitry Gutov , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Mar 17 07:28:29 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 1pd3Zk-0000N0-SR for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 17 Mar 2023 07:28:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pd3YS-0001f7-3s; Fri, 17 Mar 2023 02:27:08 -0400 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 1pd3YO-0001eH-Td for bug-gnu-emacs@gnu.org; Fri, 17 Mar 2023 02:27:04 -0400 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 1pd3YM-0002tF-R7 for bug-gnu-emacs@gnu.org; Fri, 17 Mar 2023 02:27:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pd3YM-0004VY-F6 for bug-gnu-emacs@gnu.org; Fri, 17 Mar 2023 02:27:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 17 Mar 2023 06:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50470 X-GNU-PR-Package: emacs Original-Received: via spool by 50470-submit@debbugs.gnu.org id=B50470.167903441317312 (code B ref 50470); Fri, 17 Mar 2023 06:27:02 +0000 Original-Received: (at 50470) by debbugs.gnu.org; 17 Mar 2023 06:26:53 +0000 Original-Received: from localhost ([127.0.0.1]:43476 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pd3YD-0004VA-Fj for submit@debbugs.gnu.org; Fri, 17 Mar 2023 02:26:53 -0400 Original-Received: from mail-pg1-f177.google.com ([209.85.215.177]:41475) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pd3YB-0004Uv-27 for 50470@debbugs.gnu.org; Fri, 17 Mar 2023 02:26:51 -0400 Original-Received: by mail-pg1-f177.google.com with SMTP id z10so2304142pgr.8 for <50470@debbugs.gnu.org>; Thu, 16 Mar 2023 23:26:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679034405; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=wLV/Qv93LMzBskZJQ5vNkPxAjrKPMhq6VpELTQwjPNs=; b=lNIOjLd7fe/xlLnqqR2mxhSupC7kEbPhxv4RLEZ0iUcWQ7yr2Mw048aQ2sIg0OJbjE q50VV6xnpcGYef446SJEP0MjQlvsnT5dj4PZpbYxpaKse+RK8EP0rwNKndACNTzHDOgA ajL6o1U6heDsM/3mv/YQCAuehkgxvpWuwI+Yqtx0/OfbCpPkfNkCnogqkfIojBieeAJN tX/uApvSI7yrk9EugaD/UCRyL1Z+DuXUTjAZw9JdOxFgn5JDvDdh/264O+0iabDIInH5 guLyKODGEvidiO1eTictIqUKgNmU9/ax8cdhUdoTA+80bjoLZzMW2sYMiWgFbe3WF77x 6g3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679034405; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=wLV/Qv93LMzBskZJQ5vNkPxAjrKPMhq6VpELTQwjPNs=; b=C4UkDPVnGSunn0Zs3GAED6KrtTVthdXxUzl1wdHumHHYO7/+HWVe12Dp5bo68DH7xK bHi0WLZptfAj1cHl8FRcVtW4hdmwGJg2Ygty8QRAi38BFuomQt7JItsFQy9l0HoIz30a FNaACjjkAvPfTnHcNq561AFiHDZ221fH8AbRHiUphYvIacFbE9nk23I8War2O4N/eay/ eYzvtIXB04e+ucfrHdv0BM5HWA30d8ic5Z12FeOFRKpH7LVCWeyR+tu0RiprsCOroJ5l JkGXj94Fm/KZFW0t6fsOBcn+hHvKRMY3+rtyOa9jn/CAOfLUCxerRYP/t9JJobN6Iw8S QyCA== X-Gm-Message-State: AO0yUKW3px8c1hxfp0nCA/xM899N0BIhCTWxJgMokzJvYUII/CeGMs0q k19X978UCMUEy5AwbYk1BMM= X-Google-Smtp-Source: AK7set+MVNHcM1Xlk5ZIKQKgnyh348iFAc0AFaxvuceOvZIdYgrBm2BhYatStz9p+RnnDVWHEQ5C0w== X-Received: by 2002:a62:4d41:0:b0:625:e1a3:1323 with SMTP id a62-20020a624d41000000b00625e1a31323mr5056310pfb.14.1679034405122; Thu, 16 Mar 2023 23:26:45 -0700 (PDT) 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 a6-20020aa780c6000000b005a9ea5d43ddsm741591pfn.174.2023.03.16.23.26.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Mar 2023 23:26:44 -0700 (PDT) Content-Language: en-US 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:258048 Archived-At: I've recently been digging through how Eshell and Pcomplete interact, so I think I understand what's happening here. On 6/7/2022 3:39 PM, Dmitry Gutov wrote: > pcomplete-completions-at-point somehow has pcomplete-stub pointing to > the necessary value (e.g. "/home/dgutov/Do") in the asterisk-less cases > (due to some other code path being taken), but not in this specific one. I believe the problem is that when Eshell parses the command line to figure out what to give Pcomplete, it expands the globs itself, so things get messed up. So we want to prevent glob-expansion before passing to Pcomplete. The below patch does this, but it's probably not the right way to do it. However, it's a simple change, and before I go through the larger effort of a proper patch, I want to be sure I'm actually solving the right thing. For some background/explanation of how I'm thinking we should solve this: in Emacs 30, while fixing some other completion issues, I added 'eshell-complete--eval-argument-form' (Emacs 29 does a similar thing, but the code is in 'eshell-complete-parse-arguments'). We probably want to enhance this function so that it only evaluates Eshell arguments forms that we know are ok. For a fun example of why the current behavior is wrong, try pressing TAB at the end of this command: "cd ${sleep 5; echo Doc}". Yes, it actually *runs* that subcommand before passing it to Pcomplete. :/ -------------------------------------------------- diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el index b65652019d4..7168f91d774 100644 --- a/lisp/eshell/em-cmpl.el +++ b/lisp/eshell/em-cmpl.el @@ -325,6 +325,10 @@ eshell-complete-parse-arguments (if (= begin end) (end-of-line)) (setq end (point-marker))) + ;; Don't expand globs when parsing arguments; we want to pass any + ;; globs to Pcomplete unaltered. + (let ((eshell-parse-argument-hook (remq #'eshell-parse-glob-chars + eshell-parse-argument-hook))) (if (setq delim (catch 'eshell-incomplete (ignore @@ -341,7 +345,7 @@ eshell-complete-parse-arguments ((member (car delim) '("(" "$(")) (throw 'pcompleted (elisp-completion-at-point))) (t - (eshell--pcomplete-insert-tab)))) + (eshell--pcomplete-insert-tab))))) (when (get-text-property (1- end) 'comment) (eshell--pcomplete-insert-tab)) (let ((pos (1- end)))