zsh-workers
 help / color / mirror / code / Atom feed
* Re: _expand doesn't do brace expansion?
@ 2000-06-15  9:20 Sven Wischnowsky
  2000-06-15 10:22 ` Bart Schaefer
  0 siblings, 1 reply; 6+ messages in thread
From: Sven Wischnowsky @ 2000-06-15  9:20 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> This is with all the latest patches (up to 11910):
> 
> zagzig[35] ls Functions/{Misc,Prompts}<TAB>
> Completing `file' or `corrections'(BEEP)
> zagzig[35] ls Functions/{Misc,Prompts}<C-x e>
> (BEEP)
> zagzig[35] ls Functions/{Misc,Prompts}<M-x expand-or-complete RET>
> zagzig[35] ls Functions/Misc Functions/Prompts
> 
> The test on line 85 is making it bail out early, but even with that test
> removed it doesn't expand the braces.

Oh, didn't everyone know that?

  % a='a{x,y}b'
  % echo ${(e)a}
  a{x,y}b
  % echo ${~a}
  a{x,y}b
  % echo damn
  right

Change (e)? Use `eval echo ...'? Urgh?

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: _expand doesn't do brace expansion?
  2000-06-15  9:20 _expand doesn't do brace expansion? Sven Wischnowsky
@ 2000-06-15 10:22 ` Bart Schaefer
  0 siblings, 0 replies; 6+ messages in thread
From: Bart Schaefer @ 2000-06-15 10:22 UTC (permalink / raw)
  To: Sven Wischnowsky, zsh-workers

On Jun 15, 11:20am, Sven Wischnowsky wrote:
} Subject: Re: _expand doesn't do brace expansion?
}
} Oh, didn't everyone know that?

_complete manages to complete inside braces; why does the code that
understands braces stop taking them apart when there's a closed pair?
AFAICT, no completion works at all once any close brace is in place,
even if that's within an outer set of braces, e.g.

zagzig[52] ls Functions/({Mi<TAB>
zagzig[52] ls Functions/{{Misc/<,TAB>
zagzig[52] ls Functions/{{Misc,
Completing file
README.zftp   Zftp/         Prompts/      CVS/                      
Makefile.in   Zle/          Misc/                                 
zagzig[52] ls Functions/{{Misc,P<TAB>
zagzig[52] ls Functions/{{Misc,Prompts/<},TAB>
zagzig[52] ls Functions/{{Misc,Prompts},
Completing `file' or `corrections'
(BEEP)

}   % a='a{x,y}b'
}   % echo ${(e)a}
}   a{x,y}b

That is kinda grody.

It ought to be possible to turn 'a{x,y}b' into 'a${^=:-x y}b' and then
use ${(e)...} on that; but dang it's tough to match a curly brace inside
a ${var/pat/rep} expression without causing a parse error.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: _expand doesn't do brace expansion?
  2000-06-15 10:58 ` Sven Wischnowsky
@ 2000-06-15 15:08   ` Bart Schaefer
  0 siblings, 0 replies; 6+ messages in thread
From: Bart Schaefer @ 2000-06-15 15:08 UTC (permalink / raw)
  To: zsh-workers

Let me preface this by saying:  Don't feel obligated to do anything about
this at all; I'm just trying to make helpful suggestions.

On Jun 15, 12:45pm, Sven Wischnowsky wrote:
} Subject: Re: _expand doesn't do brace expansion?
}
} Bart Schaefer wrote:
} 
} > _complete manages to complete inside braces; why does the code that
} > understands braces stop taking them apart when there's a closed pair?
} 
} With `a{b,c}<TAB>' the completion code would have to generate the
} matches for `ab' and `ac', then built the intersection to get the
} suffixes (and prefixes if there's a suffix, i.e. the middle-strings)
} which are in both sets (in all n sets, actually).

Forget the intersection; complete the union.  With braces, it doesn't
matter if some of the results e.g. don't exist as files.

Usually I'm typing something like

	ln -s /usr{/local,}bin/blahblahblah

and what I want is to complete along *either* path, not along *both*,
because the thing I'm trying to complete only exists in one of them.

} And that mey be
} combined with arbitrarily complicated match specs. Frightening.

There at least I think you'd be justified to consider anything inside a
closed pair of braces in the prefix to be ineligible for comparison to
match specs -- essentially, ineligible for anything that would insert
characters anywhere other than at the cursor.

} About the other thing, a careful `eval exp=(...)' could do the job
} (avoiding error messages and such).

Quite probably.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: _expand doesn't do brace expansion?
@ 2000-06-15 10:58 ` Sven Wischnowsky
  2000-06-15 15:08   ` Bart Schaefer
  0 siblings, 1 reply; 6+ messages in thread
From: Sven Wischnowsky @ 2000-06-15 10:58 UTC (permalink / raw)
  To: zsh-workers


I wrote:

> It simply gives up.
> 
> With `a{b,c}<TAB>' the completion code would have to generate the
> matches for `ab' and `ac', then built the intersection to get the
> suffixes (and prefixes if there's a suffix, i.e. the middle-strings)
> which are in both sets (in all n sets, actually). And that mey be
> combined with arbitrarily complicated match specs. Frightening.
> 
> Or have I missed something?

Errr, sorry. With `a{{c,d},' it could work, of course. But it still
gives up, hm.


About the other thing, a careful `eval exp=(...)' could do the job
(avoiding error messages and such).


Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: _expand doesn't do brace expansion?
@ 2000-06-15 10:45 Sven Wischnowsky
  2000-06-15 10:58 ` Sven Wischnowsky
  0 siblings, 1 reply; 6+ messages in thread
From: Sven Wischnowsky @ 2000-06-15 10:45 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> On Jun 15, 11:20am, Sven Wischnowsky wrote:
> } Subject: Re: _expand doesn't do brace expansion?
> }
> } Oh, didn't everyone know that?
> 
> _complete manages to complete inside braces; why does the code that
> understands braces stop taking them apart when there's a closed pair?
> AFAICT, no completion works at all once any close brace is in place,
> even if that's within an outer set of braces, e.g.

It simply gives up.

With `a{b,c}<TAB>' the completion code would have to generate the
matches for `ab' and `ac', then built the intersection to get the
suffixes (and prefixes if there's a suffix, i.e. the middle-strings)
which are in both sets (in all n sets, actually). And that mey be
combined with arbitrarily complicated match specs. Frightening.

Or have I missed something?

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 6+ messages in thread

* _expand doesn't do brace expansion?
@ 2000-06-15  9:09 Bart Schaefer
  0 siblings, 0 replies; 6+ messages in thread
From: Bart Schaefer @ 2000-06-15  9:09 UTC (permalink / raw)
  To: zsh-workers

This is with all the latest patches (up to 11910):

zagzig[35] ls Functions/{Misc,Prompts}<TAB>
Completing `file' or `corrections'(BEEP)
zagzig[35] ls Functions/{Misc,Prompts}<C-x e>
(BEEP)
zagzig[35] ls Functions/{Misc,Prompts}<M-x expand-or-complete RET>
zagzig[35] ls Functions/Misc Functions/Prompts

The test on line 85 is making it bail out early, but even with that test
removed it doesn't expand the braces.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2000-06-15 15:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-15  9:20 _expand doesn't do brace expansion? Sven Wischnowsky
2000-06-15 10:22 ` Bart Schaefer
  -- strict thread matches above, loose matches on Subject: below --
2000-06-15 10:45 Sven Wischnowsky
2000-06-15 10:58 ` Sven Wischnowsky
2000-06-15 15:08   ` Bart Schaefer
2000-06-15  9:09 Bart Schaefer

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).