From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Federico Tedin via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#70198: M-x shell: deal with environment variables present when tab expanding Date: Wed, 10 Jul 2024 20:11:07 +0200 Message-ID: <87frshyv5w.fsf@gmx.de> References: <87plrlz06s.fsf@gmx.de> <86wmltm994.fsf@gnu.org> Reply-To: Federico Tedin Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5377"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 70198@debbugs.gnu.org, jidanni@jidanni.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jul 10 20:23:26 2024 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 1sRbyQ-0001DC-L1 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 10 Jul 2024 20:23:26 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sRbxy-0006hi-IR; Wed, 10 Jul 2024 14:22:58 -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 1sRbxw-0006hR-OE for bug-gnu-emacs@gnu.org; Wed, 10 Jul 2024 14:22:56 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sRbxv-0007KC-Q8 for bug-gnu-emacs@gnu.org; Wed, 10 Jul 2024 14:22:56 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sRby2-00058i-1C for bug-gnu-emacs@gnu.org; Wed, 10 Jul 2024 14:23:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Federico Tedin Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 10 Jul 2024 18:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70198 X-GNU-PR-Package: emacs Original-Received: via spool by 70198-submit@debbugs.gnu.org id=B70198.172063574619714 (code B ref 70198); Wed, 10 Jul 2024 18:23:01 +0000 Original-Received: (at 70198) by debbugs.gnu.org; 10 Jul 2024 18:22:26 +0000 Original-Received: from localhost ([127.0.0.1]:57134 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sRbxR-00057q-Bw for submit@debbugs.gnu.org; Wed, 10 Jul 2024 14:22:26 -0400 Original-Received: from mout.gmx.net ([212.227.15.19]:43347) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sRbmt-0004px-P6 for 70198@debbugs.gnu.org; Wed, 10 Jul 2024 14:11:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1720635069; x=1721239869; i=federicotedin@gmx.de; bh=g2/62kiOWgWJASzlESLZDsj72S7/EFpLd0toWXLFDOk=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=RlY/MSOeU98xVG5F2wjtsOEw+AV/FbUeju4hWHfj4tkN9a58LjGQVlmVcwjoTfSp QSyWzRN8cDF6SrbFK2BcfH2bhB3t0z3eWXQpZuSe86I40OGo3lqsPvlHeOAF+3A1H Nl3Lh6S0/JSMHmeyQ7Q5FDvLlFEz++TphXZLEgOEf+BkW9W1/Q4J5+RTBb3c0++WU YYfxEQE+rclQvJhrH1cU9Y1/UYUUi/GBWTfvysGGTgDCP5Ljtw1/UUQjIcOTdUMXM n6Ix1/iY9Bs6I+YZ0mcG/wddEOhoxgUYLz9PXQOmNdS9pY5YiWuhWLgzRHx8YBhZT 1FvoM2vt5CK/c6F9kg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from seele ([91.66.5.21]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MSKuA-1splQb1A1A-00KFrm; Wed, 10 Jul 2024 20:11:09 +0200 In-Reply-To: <86wmltm994.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 10 Jul 2024 20:45:11 +0300") X-Provags-ID: V03:K1:cD/zB1a1+jeZUArw1mZoPjod2nEv3vjAmebardgTZ+DtX93WXMV rEgdOZEUZ6Qamh4MRsIislsa/89x8dDGq/aOX1yilx2jAxDA82aa0g1Uumg41wfxBw8riwW CKwlq+ELSNVXhZShkJbkvqCesdYbPIT37VdLS6P7FYRuvw2Xb0ZixaykiblZ5AJjZIsgqLS RzUyMh0R/ND69tMvsAAlw== UI-OutboundReport: notjunk:1;M01:P0:dRlHfoiRXls=;/xfx4c0zOAaBcy4HvvJI70YnXqZ xw/zaB5uhpD5lYDFIcInK5dqQE1kuuAPsYtID7rhkNhI4H2tt/ctXRypqIUVrc5bPmepGHTRb Jndyn7+bzKXtteBDpTH1dWA/Ye1xPN2wk+j/KpaiEWptnmSil7z43Bj6wir2/t32m8eJYzD7/ EWR0DU/EvVw6ARyx9w4QcB3tMtB6Z7zR+s4Go1PRgZSNlZR1TxW7/I+/4lTvLfbg3/7ZCRWVq Na+wpgEma3KeqevNaCOqktccXhLA+SL0gzimK7ZogkMUW2Ph6C3+UpS5dhUw9PZ6aC+Ixko4s gR4Y651ygGXvGde0/BI66YH8GV6BOBC/Rqa0ZMwGeb/JEP5n327KO8KhhmNp4RRwXHfhI6p0+ Eyy2MjuH2512gyKv0s8tcIoQt73t9QpeLt//2GdYjjNPIxU6bXhMiDrPBxSX7I7gL6C2Qw+tP vTChr72zs1vLc4fIDB33OEVPAtZ26WTXAqBIWUOoUTi97QHzHjc1CE+2ePjGfzGBQHPuv9VlC Hl5XLIowiJ1RShe9QQPXt91aaxo54hnAhiu6IDgzPnT2UjaTjf46IxglSQ0+kjo6R5D+0pH5r AZ0enRjg10r219OIG1NtX2MbZHImgZ35hugisac2++xn+NFvt4DY7taLZmcXCipIl+pbl3CF+ PQy7rIa0D/SBU0Dt4jR1YZOg8liXuUVzJ1gVV3T3tukjrtoViqGtxqGQhEgvzh+ZBljRD7iZb qzOSDX1HjqZmIKum6a5+wQ8EfLT5oJaWevYZAGOj4h5ya7ue9wNIrKACoOfBZ/b3Eyt3GYLx X-Mailman-Approved-At: Wed, 10 Jul 2024 14:22:23 -0400 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:288696 Archived-At: Eli Zaretskii writes: > What happens if the command itself has embedded '='? Ah good point, I incorrectly assumed that after `comint-match-partial-filename' was called, the point would be at the beginning of the command rather than at the end. That being said if we used (match-beginning 0) as PT then it would address this particular scenario (when calling `shell--skip-environment-variables' I mean). > What happens if the '=' character is quoted? What would be an example of this? (in the context of writing shell commands). > I think a better idea might be first to try to find what is "the word > at point", and then complete only that word. WDYT? Yep, however I do think we still need to walk back some words in order to ensure that we are not autocompleting an argument; for example $ echo whoam[TAB] should not autocomplete to "whoami", I'm assuming. So for the actual walking backwards we need to maybe: - modify shell-backward-command so that it leaves the point at the beginning of the command, but after any env vars - or, move backwards using `shell-command-regexp' until the last thing that does not look like FOO=BAR or FOO= is found. All of this just to ensure that the word at point is an actual command and not an argument to a command. Maybe this approach itself could be re-evaluated though !