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

From: Eli Zaretskii <[email-masked]>
Date: Thu, 11 Jul 2024 07:36:53 +0300

> From: Federico Tedin <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Wed, 10 Jul 2024 22:17:41 +0200
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> > 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.
> 
> But then, just to make sure I'm on the right track:
> 
> - When the word at point is a command (not an arg)
> `shell-command-completion' should return the proper command completions.
> 
> - When the word at point is *not* a command, `shell-command-completion' should
> return nil so that other completion functions are attempted.
> 
> And these two scenarios need to be decided on using syntax classes
> instead of regexps.

Yes, I think so.  I added Stefan to the discussion in case he has
comments or suggestions.  Stefan, what do you think is the best method
of parsing the beginning of the command line to detect where a
program's name starts?