GNU bug report logs - #70198
M-x shell: deal with environment variables present when tab expanding

Previous Next

Package: emacs;

Reported by: Dan Jacobson <jidanni <at> jidanni.org>

Date: Thu, 4 Apr 2024 13:52:02 UTC

Severity: wishlist

Full log


Message #14 received at 70198 <at> debbugs.gnu.org (full text, mbox):

From: Federico Tedin <federicotedin <at> gmx.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 70198 <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#70198: M-x shell: deal with environment variables present
 when tab expanding
Date: Wed, 10 Jul 2024 20:11:07 +0200
Eli Zaretskii <eliz <at> gnu.org> 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 !




This bug report was last modified 173 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.