From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#70198: M-x shell: deal with environment variables present when tab expanding Date: Wed, 10 Jul 2024 21:34:51 +0300 Message-ID: <86ttgxm6yc.fsf@gnu.org> References: <87plrlz06s.fsf@gmx.de> <86wmltm994.fsf@gnu.org> <87frshyv5w.fsf@gmx.de> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36196"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70198@debbugs.gnu.org, jidanni@jidanni.org To: Federico Tedin Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jul 10 20:36:23 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 1sRcAw-0009CY-9y for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 10 Jul 2024 20:36:22 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sRcAa-0000Ab-AA; Wed, 10 Jul 2024 14:36:00 -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 1sRcAY-0000AN-5T for bug-gnu-emacs@gnu.org; Wed, 10 Jul 2024 14:35:58 -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 1sRcAW-00014T-A6 for bug-gnu-emacs@gnu.org; Wed, 10 Jul 2024 14:35:56 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sRcAc-0005US-EI for bug-gnu-emacs@gnu.org; Wed, 10 Jul 2024 14:36:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 10 Jul 2024 18:36:02 +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.172063651321041 (code B ref 70198); Wed, 10 Jul 2024 18:36:02 +0000 Original-Received: (at 70198) by debbugs.gnu.org; 10 Jul 2024 18:35:13 +0000 Original-Received: from localhost ([127.0.0.1]:57145 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sRc9o-0005TJ-Jq for submit@debbugs.gnu.org; Wed, 10 Jul 2024 14:35:12 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:55726) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sRc9l-0005T1-Pa for 70198@debbugs.gnu.org; Wed, 10 Jul 2024 14:35:11 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sRc9W-0000mz-SJ; Wed, 10 Jul 2024 14:34:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=MEd6pvI0rZ9eD28MIkbPEZBYDqgvi3BoE49Y8loR6ZQ=; b=YAhzz6Kw2wbH AuNiqRGUbRxNBozw80q0I2QNljZEdYtms77Yq8RB+p74WUw6pKSpfFEli7ke1MYbFOmg1/UAjpGS0 X7vSiC0SGBJ0dx+Tg9iMJDLBxgHAabP769CYCrOhcgS6eFu1XwSY1BR4DFyDHki2BnXbmfekHUDcY crxYbe+nRbz90LcukV6XQoRMNV5at6Ms/zKIQe0VK9402Nd7DJmC3lqFd+aPlOjCpJ6TSFxpU/CxW RQQW4hvVBqKhQj5t//uPCT1+SrwFrYLL2Hw9b7XVfQrbrweU4/1d5G70IgbnfXlxrCoGPOWAapAHK jr6//SNSVQDKeXg2MhwYmw==; In-Reply-To: <87frshyv5w.fsf@gmx.de> (message from Federico Tedin on Wed, 10 Jul 2024 20:11:07 +0200) 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:288698 Archived-At: > From: Federico Tedin > Cc: jidanni@jidanni.org, 70198@debbugs.gnu.org > Date: Wed, 10 Jul 2024 20:11:07 +0200 > > Eli Zaretskii writes: > > > What happens if the '=' character is quoted? > > What would be an example of this? (in the context of writing shell > commands). Something like $ FOO='foo=bar' date > > 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. It should, just not command completion. > 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 ! If we want to detect FOO=BAR, we need to use syntax classes, and I'm not sure regexps are the best instrument for that.