zsh-workers
 help / color / mirror / code / Atom feed
* Feature idea: Expanding on completion functions
@ 2008-11-30 21:35 Richard Hartmann
  2008-11-30 22:23 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Hartmann @ 2008-11-30 21:35 UTC (permalink / raw)
  To: Zsh Workers

Hi all,

quite often, I wish I could use the output of a completion function
on the comand line. Think

  my_list=$(magic_function(apt-get install openoffice-<tab>))

The completion functions are so powerful it's a shame not to use
their output for more purposes.

Bart(?) told me this would not be an easy thing to do so I think
it makes sense to implement this through a shell feature or not
at all.


Thoughts, feedback, suggestions?
Richard


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

* Re: Feature idea: Expanding on completion functions
  2008-11-30 21:35 Feature idea: Expanding on completion functions Richard Hartmann
@ 2008-11-30 22:23 ` Bart Schaefer
  2008-11-30 22:49   ` Richard Hartmann
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2008-11-30 22:23 UTC (permalink / raw)
  To: Zsh Workers

On Nov 30, 10:35pm, Richard Hartmann wrote:
}
} The completion functions are so powerful it's a shame not to use
} their output for more purposes.

Without necessarily shooting down this idea, let me point out that
completion functions don't have output.  I think the following is
mostly similar to what I said before:

What completion functions do is shove a large number of *possible*
completions into the "compadd" builtin.  Typically they generate WAY
more possibilities than you ever see as "output" ... a lot of the
magic hides in the way completion uses the contents of the command
line at or around the cursor position to throw away most of the data
that was fed to it, so you see the relevant remainder.

The rest of the magic comes from the constellation of variables that
describe the command line context so that the completion functions
have some idea where to look for possible completions.

To use the completion functions for more purposes, you have to both
populate all those context variables appropriately to each of those
other purposes, and also create the appropriate filters to remove
whatever is irrelevant to each purpose.

And then you have to decouple the stuff that performs the filtering
from the stuff that displays the results in ZLE, which is the only
place that any "output" goes right now.

-- 


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

* Re: Feature idea: Expanding on completion functions
  2008-11-30 22:23 ` Bart Schaefer
@ 2008-11-30 22:49   ` Richard Hartmann
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Hartmann @ 2008-11-30 22:49 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh Workers

On Sun, Nov 30, 2008 at 23:23, Bart Schaefer <schaefer@brasslantern.com> wrote:

> Without necessarily shooting down this idea, let me point out that
> completion functions don't have output.

No, no, feedback is good. Thanks for taking the time to write it out
in this level of detail.


> And then you have to decouple the stuff that performs the filtering
> from the stuff that displays the results in ZLE, which is the only
> place that any "output" goes right now.

Wouldn't a relatively easy way to do this be to copy all state and
execute the completion in this context? All the filtering etc could
happen in the normal way as all potentional output which is filtered
away is not interesting (to me) at that point, anyway.


Richard


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

end of thread, other threads:[~2008-11-30 22:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-30 21:35 Feature idea: Expanding on completion functions Richard Hartmann
2008-11-30 22:23 ` Bart Schaefer
2008-11-30 22:49   ` Richard Hartmann

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