zsh-users
 help / color / mirror / code / Atom feed
From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: saved from prince of eval
Date: Tue, 10 Nov 2015 17:07:30 -0800	[thread overview]
Message-ID: <564294D2.6050201@eastlink.ca> (raw)
In-Reply-To: <151109104128.ZM794@torch.brasslantern.com>

On 11/09/2015 10:41 AM, Bart Schaefer wrote:
>     IN[PAGE]=${${(P)IN[list]}[IN[topE],IN[bottomE]]}
>
Thanks.

I've realized that my friend '(e)' was with the Enemy all along.  I have 
a function that prints out a half sane modification of 'set', and sure 
enough:
> }      foo="\$${IN[list]}[${IN[topE]}, ${IN[bottomE]}]"
> }      IN[PAGE]="${(e)foo}"
Ended up 'evaling'  the content and doubling the size of my environment 
every time it was run.  It's seems strange tho, how can a parameter be 
set twice (or 16 times) to exactly the same value? But your line above 
seems, finally,  to do what it's asked to do without evaling anything.

Speaking of which, we have 'env' which only gives us the--don't know the 
proper term--lowest level system stuff. And we have 'set' which gives us 
everything including the kitchen sink.  So I have this:

    #1) strip out the color.
    #2) cut lines down to 80 chars (some are a thousand).
    #3) select only things that are probably variables.
    eenv ()
    {
         set |
         sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" |
         sed 's|^\(.\{1,80\}\).*|\1|' |
         grep --binary-files=text '='
    }


... which is an effort to display just the current parameters. However 
the output refuses to open in any of my editors if piped to a file, they 
all think it's binary.  Looking at it in hex, I see that it's a soup of 
backslashes and single quotes. Why is that?  Is there a civilized way of 
listing all current parameters that's just plain text, no backslashes?  
Not knowing the hierarchy, perhaps even avoiding those deep things like 
'color=' which isn't something one wants to look at very often--those 
deep internal things that have nothing to do with the user.  It would be 
a useful thing.



  parent reply	other threads:[~2015-11-11  1:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-08 17:07 Ray Andrews
2015-11-08 19:57 ` Bart Schaefer
2015-11-08 22:04   ` Ray Andrews
2015-11-09  8:50     ` Ray Andrews
2015-11-09 18:41       ` Bart Schaefer
2015-11-10  0:48         ` Ray Andrews
2015-11-11  1:07         ` Ray Andrews [this message]
2015-11-11  4:18           ` Bart Schaefer
2015-11-11  5:31             ` Ray Andrews

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=564294D2.6050201@eastlink.ca \
    --to=rayandrews@eastlink.ca \
    --cc=zsh-users@zsh.org \
    /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).