zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: Bug: Ubuntu apt-get install package-*
Date: Thu, 10 Nov 2016 18:54:48 -0800	[thread overview]
Message-ID: <161110185448.ZM25929@torch.brasslantern.com> (raw)
In-Reply-To: <CAOCsvouMHChh5-Yk_FJYj0cx5wDe9rHmFsiu8EzUaSQ3X665ZQ@mail.gmail.com>

[>workers]

On Nov 10, 10:43pm, Bob wrote:
}
} When I run install commands with `*` for all packages I get a zsh error
} while it works in bash.

Maybe it's time for something like this?

(Truly horrible implementation follows, don't commit this, presented
for example purposes only, etc. etc.)

torch% echo bl?or*
zsh: no matches found: bl?or*
torch% setopt correctall
torch% echo bl?or*      
zsh: correct 'bl?or*' to 'bl\?or\*' [nyae]? y
bl?or*


diff --git a/Src/utils.c b/Src/utils.c
index 3d535b8..b9cd227 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -2948,6 +2948,31 @@ spckword(char **s, int hist, int cmd, int ask)
 	return;
     if (!(*s)[0] || !(*s)[1])
 	return;
+
+    if (!incond && !incmdpos && isset(NOMATCH) && haswilds(*s)) {
+	char *b, *g;
+	untokenize(g = dupstring(guess = *s));
+	b = quotestring(best = g, QT_BACKSLASH_PATTERN);
+	if (ask) {
+	    if (noquery(0)) {
+		x = 'n';
+	    } else if (shout) {
+		char *pptbuf;
+		pptbuf = promptexpand(sprompt, 0, b, g, NULL);
+		zputs(pptbuf, shout);
+		free(pptbuf);
+		fflush(shout);
+		zbeep();
+		x = getquery("nyae \t", 0);
+		if (cmd && x == 'n')
+		    pathchecked = path;
+	    } else
+		x = 'n';
+	} else
+	    x = 'y';
+	goto Interpret;
+    }
+
     if (cmd) {
 	if (shfunctab->getnode(shfunctab, *s) ||
 	    builtintab->getnode(builtintab, *s) ||
@@ -3087,6 +3112,7 @@ spckword(char **s, int hist, int cmd, int ask)
 		x = 'n';
 	} else
 	    x = 'y';
+    Interpret:
 	if (x == 'y' || x == ' ' || x == '\t') {
 	    *s = dupstring(best);
 	    if (hist)


  reply	other threads:[~2016-11-11  2:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-10 22:43 Bob
2016-11-11  2:54 ` Bart Schaefer [this message]
2016-11-14 16:25   ` Oliver Kiddle
2016-11-14 17:29     ` Bart Schaefer
2016-11-11  4:49 ` Eric Cook

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=161110185448.ZM25929@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.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.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).