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

Re: Line numbers and debugging verbosity



On 08/04/18 10:19 PM, Bart Schaefer wrote:
functions -T test1

Not working yet, but I know what to research, so it will work shorty.  Anyway, the idea is not a full debug, just some helpful indication where a message comes from.  I can't stand it when I see some message and have no idea who is sending it to me, thereottabealaw!
   warningmsg() {
     print -n "${funcfiletrace[1]}: " && magline "$*"
   }

Marvellous.  Perfect, right out of the box, no need for any alias at all.  Why don't they know about this on the internet?  There's many queries about line numbers, but the answer is always the alias.
Just put a similar test in the definition of "warningmsg" e.g.

   warningmsg() {
     (( $dbg )) &&
     print -nr - "${funcfiletrace[1]}: " && magline "$*"
   }

Now you don't have to modify the function, you just assign dbg=1 or dbg=0.

Sure, *once* we're back with functions, it's easy.   Once any need for an alias to capture the line numbers is gone, all problems vanish.  Ironically, last night I figured out how to make it work with aliases too, but the above is vastly better anyway.   It's pleasing to know that the extra strictness of '5.5 has not really robbed me of any functionality, just stopped me from doing things a way that I know perfectly well is bogus.




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