Re: [PATCH] Save more readline state when running compgen

2023-03-21 Thread Koichi Murase
2023年3月22日(水) 6:00 Greg Wooledge : > I don't use programmable completion, but I could *imagine* someone using > a temp file to store the results, then using mapfile to read them back > in, to avoid the fork() that the command substitution uses. I wouldn't say my usage is typical, but I do that in

Re: [PATCH] Save more readline state when running compgen

2023-03-21 Thread Grisha Levit
On Tue, Mar 21, 2023 at 5:52 PM alex xmb ratchev wrote: > On Tue, Mar 21, 2023, 22:42 Grisha Levit wrote: >> Let's say you want to know if there are any entries starting with >> `foo' in the current directory. You can do: > > i see , thank you sir > i .. mostly dont have that case ( if existing

Re: [PATCH] Save more readline state when running compgen

2023-03-21 Thread alex xmb ratchev
On Tue, Mar 21, 2023, 22:42 Grisha Levit wrote: > On Tue, Mar 21, 2023 at 5:26 PM alex xmb ratchev > wrote: > > On Tue, Mar 21, 2023, 21:05 Grisha Levit wrote: > >> > >> compgen -G 'foo/*' >/dev/null && COMPREPLY=(bar) > > > > i dont get that code at all , but i like idea of speedier file filli

Re: [PATCH] Save more readline state when running compgen

2023-03-21 Thread Grisha Levit
On Tue, Mar 21, 2023 at 5:26 PM alex xmb ratchev wrote: > On Tue, Mar 21, 2023, 21:05 Grisha Levit wrote: >> >> compgen -G 'foo/*' >/dev/null && COMPREPLY=(bar) > > i dont get that code at all , but i like idea of speedier file filling .. can > u explain some in short ? Let's say you want to kn

Re: [PATCH] Save more readline state when running compgen

2023-03-21 Thread alex xmb ratchev
On Tue, Mar 21, 2023, 21:05 Grisha Levit wrote: > On Tue, Mar 21, 2023 at 3:47 PM Chet Ramey wrote: > > OK, say you did in fact run compgen in the foreground -- very unusual > > because it's awkward to capture the possible completions that way -- to > > generate completions. > > Sorry I should h

Re: [PATCH] Save more readline state when running compgen

2023-03-21 Thread alex xmb ratchev
On Tue, Mar 21, 2023, 21:05 Grisha Levit wrote: > On Tue, Mar 21, 2023 at 3:47 PM Chet Ramey wrote: > > OK, say you did in fact run compgen in the foreground -- very unusual > > because it's awkward to capture the possible completions that way -- to > > generate completions. > > Sorry I should h

Re: [PATCH] Save more readline state when running compgen

2023-03-21 Thread Greg Wooledge
On Tue, Mar 21, 2023 at 04:52:03PM -0400, Grisha Levit wrote: > On Tue, Mar 21, 2023 at 4:11 PM Chet Ramey wrote: > > OK, which do you think would be the more common case? Wanting the options > > used to generate completions to persist or using it in this way? > > Usually people do `COMPREPLY=($(

Re: [PATCH] Save more readline state when running compgen

2023-03-21 Thread Grisha Levit
On Tue, Mar 21, 2023 at 4:11 PM Chet Ramey wrote: > OK, which do you think would be the more common case? Wanting the options > used to generate completions to persist or using it in this way? Usually people do `COMPREPLY=($(compgen ...))' (or write to stdout in a command specified with `complete

Re: [PATCH] Save more readline state when running compgen

2023-03-21 Thread Chet Ramey
On 3/21/23 4:04 PM, Grisha Levit wrote: On Tue, Mar 21, 2023 at 3:47 PM Chet Ramey wrote: OK, say you did in fact run compgen in the foreground -- very unusual because it's awkward to capture the possible completions that way -- to generate completions. Sorry I should have explained. I hit th

Re: [PATCH] Save more readline state when running compgen

2023-03-21 Thread Grisha Levit
On Tue, Mar 21, 2023 at 3:47 PM Chet Ramey wrote: > OK, say you did in fact run compgen in the foreground -- very unusual > because it's awkward to capture the possible completions that way -- to > generate completions. Sorry I should have explained. I hit this issue because I was using compgen i

Re: wait on procsub in EXIT trap

2023-03-21 Thread Chet Ramey
On 3/21/23 3:53 PM, Grisha Levit wrote: So to wait for a procsub after receiving a terminating signal, one must do so in a trap for the signal itself and not in an EXIT trap. Yes, that would probably work. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars l

Re: wait on procsub in EXIT trap

2023-03-21 Thread Grisha Levit
On Tue, Mar 21, 2023 at 3:28 PM Chet Ramey wrote: > > > Interestingly, if an external command or a subshell is executed after > > the process substitution is started but prior to receipt of the > > signal, the `wait' works fine: > > > > $ (trap 'wait $!; echo $?' EXIT; : <(:); (:); kill 0) > > Bec

Re: [PATCH] Save more readline state when running compgen

2023-03-21 Thread Chet Ramey
On 3/19/23 10:08 PM, Grisha Levit wrote: Completion state is not fully restored after invoking `compgen' within a competition function. Normally, if a compspec does not specifically include one of the options that triggers filename completion, the generated completions are not treated as filenam

Re: wait on procsub in EXIT trap

2023-03-21 Thread Chet Ramey
On 3/19/23 11:10 PM, Grisha Levit wrote: If an EXIT trap is executed after receipt of a terminating signal, waiting on a process substitution within the trap can fail: The terminating signal handler cleans up FIFOs and any running procsubs before running the exit trap, which is the last thing i

Re: compgen respecting dotglob changes

2023-03-21 Thread Chet Ramey
On 3/19/23 9:02 PM, Grisha Levit wrote: compgen's glob matching does not respect dotglob being turned on or off unless some other globbing takes place between the setting being changed and compgen being called: Thanks for the report. -- ``The lyf so short, the craft so long to lerne.'' - Chauc