all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Federico Tedin <federicotedin@gmx.de>
Cc: 70198@debbugs.gnu.org, jidanni@jidanni.org
Subject: bug#70198: M-x shell: deal with environment variables present when tab expanding
Date: Wed, 10 Jul 2024 21:34:51 +0300	[thread overview]
Message-ID: <86ttgxm6yc.fsf@gnu.org> (raw)
In-Reply-To: <87frshyv5w.fsf@gmx.de> (message from Federico Tedin on Wed, 10 Jul 2024 20:11:07 +0200)

> From: Federico Tedin <federicotedin@gmx.de>
> Cc: jidanni@jidanni.org,  70198@debbugs.gnu.org
> Date: Wed, 10 Jul 2024 20:11:07 +0200
> 
> Eli Zaretskii <eliz@gnu.org> 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.





  reply	other threads:[~2024-07-10 18:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-04 13:51 bug#70198: M-x shell: deal with environment variables present when tab expanding Dan Jacobson
2024-07-10 16:22 ` Federico Tedin via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-10 17:45   ` Eli Zaretskii
2024-07-10 18:11     ` Federico Tedin via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-10 18:34       ` Eli Zaretskii [this message]
2024-07-10 20:17         ` Federico Tedin via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-11  4:36           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86ttgxm6yc.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=70198@debbugs.gnu.org \
    --cc=federicotedin@gmx.de \
    --cc=jidanni@jidanni.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.