Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] Let run-help try to show function source from file (was Re: [RFC][PATCH] Try calling command with help flags in run-help)



On Sun, Jun 20, 2021 at 2:24 PM Lawrence Velázquez <larryv@xxxxxxx> wrote:
>
> On Wed, Jun 2, 2021, at 2:26 PM, Marlon Richert wrote:
> > Here's part of workers 48926 as a separate patch.
> >
> > Attachments:
> > * 0001-Let-run-help-try-to-show-function-source-from-file.txt
>
> ping, needs review

Finally looked a little more closely at this.

I don't think we can allow it to unconditionally run
  autoload +X -Uz $func
because for example it's always possible that $func should be
autoloaded with -k instead.  Further, even if we grab the correct
autoload flags, it's possible that loading the function will have some
side-effects, or that loading it with +X will omit some necessary
side-effects.

Also, if the function was loaded from a zcompile file, displaying
$functions_source[$func] with the pager will either fail or be a mess.

There's also the minor point that if the function came from a file
containing multiple other functions, you get way more than you asked
for.




Messages sorted by: Reverse Date, Date, Thread, Author