unofficial mirror of bug-gnu-emacs@gnu.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 20:45:11 +0300	[thread overview]
Message-ID: <86wmltm994.fsf@gnu.org> (raw)
In-Reply-To: <87plrlz06s.fsf@gmx.de> (bug-gnu-emacs@gnu.org)

> Cc: 70198@debbugs.gnu.org
> Date: Wed, 10 Jul 2024 18:22:35 +0200
> From:  Federico Tedin via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> +	         (save-match-data (not (string-match "[~/]" filename)))
> +	         (eq (match-beginning 0)
> +		         (save-excursion
> +                   ;; Go back to beginning of command
> +                   (shell-backward-command 1)
> +                   ;; Skip any potential environment variables
> +                   (shell--skip-environment-variables pt)
> +                   (point))))
> +	    (shell--command-completion-data))))
> +
> +(defun shell--skip-environment-variables (pt)
> +  "Move forward up to PT through any present environment variables."
> +  (while (re-search-forward "=" pt t)
> +    (skip-syntax-forward "^ " pt)
> +    (skip-syntax-forward " " pt)))

What happens if the command itself has embedded '='?
What happens if the '=' character is quoted?

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?





  reply	other threads:[~2024-07-10 17:45 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 [this message]
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
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=86wmltm994.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).