zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh User <zsh-users@sunsite.dk>
Subject: Re: [zsh] Re: dirstack history: loving zsh, crashing zsh...
Date: Mon, 06 Mar 2006 08:51:36 -0800	[thread overview]
Message-ID: <060306085136.ZM4149@torch.brasslantern.com> (raw)
In-Reply-To: <20060306130139.GA9256@let.rug.nl>

On Mar 6,  2:01pm, Francisco Borges wrote:
}
} it won't stop that accumulation of repeated directories at .zdirs
} (essentially since "dirs" always include the CWD).

If that's the only issue, then don't use "dirs" at all; instead use
"print $dirstack" which *won't* include the current directory.

} > 	dirstack=( ${(u)$(< ~/.zdirs)} )
} 
} But the "u" parameter solves it indeed! Thank you very much for pointing
} it.

One other thing that just occurred to me is that a single line of
output is unreliable when a directory name may contains whitespace.
You should use:

	print -l $dirstack > ~/.zdirs
and
	dirstack=( ${(uf)"$(< ~/.zdirs)"} )

} > } OR you guys are now going to say: "Don't you know you're not supposed
} > } to use typeset with dirstack!!"
} >
} > You aren't
} 
} Is there any reason for why?

We're having a discussion about that over on zsh-workers right now.  My
position is that $dirstack is just a view on an internal data structure
that cannot be held responsible for the flags set on the parameter, and
therefore for consistency the parameter should not be allowed to have
flags that conflict with that internal structure (it happens to be a
linked list).

} I assumed I could treat dirstack as any other array since, well,
} the *manual* says dirstack is "a normal array".

I think "normal array" just means it's not an "associative array".

The only way to impose consistency with "typeset -U dirstack" on the
underlying internal structure would be to add

    chpwd() { dirstack=( ${(u)dirstack} ) }


  reply	other threads:[~2006-03-06 16:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-02 17:52 Francisco Borges
2006-03-02 18:07 ` William Scott
2006-03-05  9:19 ` Bart Schaefer
2006-03-06 13:01   ` [zsh] " Francisco Borges
2006-03-06 16:51     ` Bart Schaefer [this message]
2006-03-06 18:26       ` [zsh] " Francisco Borges
2006-03-07  3:54         ` Bart Schaefer

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=060306085136.ZM4149@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@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).