zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: "Dieter Lambrecht" <dieter.lambrecht@db.com>, zsh-workers@sunsite.dk
Subject: Re: zsh-4.2.1: LINENO lost in evals
Date: Wed, 01 Sep 2004 13:02:07 +0100	[thread overview]
Message-ID: <200409011202.i81C27ic008335@news01.csr.com> (raw)
In-Reply-To: ""Dieter Lambrecht""'s message of "Tue, 17 Aug 2004 10:27:02 +0200." <OF8801BB61.FCB678DF-ONC1256EF3.002DD124-C1256EF3.002E7094@db.com>

"Dieter Lambrecht" wrote:
>#! /bin/zsh -x
>emulate -L zsh
>
>print $LINENO
>eval 'print $LINENO'
>
>return
>
> produces the following output:
>
> ./t4.sh
> +./t4.sh:2> emulate -L zsh
> +./t4.sh:4> print 4
> 4
> +./t4.sh:5> eval 'print $LINENO'
> +(eval):1> print 1
> 1
> .
> 
> It seems that LINENO is lost in the eval-statement. Is there any possib=
> ility to retrieve the original value inside evals ?

(There must be a set -x or setopt xtrace lurking somewhere.)

It's not actually lost, it's showing you the line in the eval.  That's
a feature (compare error messages from Perl evals, which is where we
pinched the output format from).

What are you trying to do?  You can record the line number outside if
you need it, e.g.

lineno=LINENO; eval 'print $lineno'

I take it the complaint isn't about the debugging output from xtrace
this time, since that shows the line number of the eval command (5).

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


  reply	other threads:[~2004-09-01 12:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-17  8:27 Dieter Lambrecht
2004-09-01 12:02 ` Peter Stephenson [this message]
2004-09-01 15:10   ` Bart Schaefer
2004-09-02 13:57 Dieter Lambrecht
2004-09-02 15:53 ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200409011202.i81C27ic008335@news01.csr.com \
    --to=pws@csr.com \
    --cc=dieter.lambrecht@db.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).