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

Re: Source mangling in $functions_source and typeset -f



Bart Schaefer wrote on Mon, Nov 29, 2021 at 09:55:07 -0800:
> On Mon, Nov 29, 2021 at 8:00 AM Peter Stephenson
> <p.w.stephenson@xxxxxxxxxxxx> wrote:
> >
> > > On 27 November 2021 at 17:47 Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> > >
> > > The parse tree only tracks the line numbers of executable code, so as
> > > to be able to update the LINENO variable and print line numbers in
> > > debug traces and prompts.
> >
> > Actually, the original line number is remembered, and can be output
> > using a prompt
> 
> That's what I thought I said ...
> 
> > I don't think there's any way of getting this information without actually executing
> > the code, though.
> 
> ... which is exactly the problem here.

We _could_ teach zsh/parameter to emit this information, so, say,
${functions_source2[foo]} might expand to "/some/file.zsh:42", if that's
the filename and line number foo() was last defined at.

Another approach would be to use tools such as ctags.




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