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

Re: please conform to the xdg base directory specification

On Fri, 16 Aug 2013 20:20:19 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Aug 15,  7:54pm, Peter Stephenson wrote:
> }
> } Adding yet more complexity to the initialisation file logic doesn't seem
> } a great idea, but one thing that could keep everything more or less
> } under control would be to make ZDOTDIR a colon-separated array (and make
> } zdotdir an array).
> ... this suggestion, while fine on its own, does not solve the problem of
> bootstrapping the value of ZDOTDIR, so zsh would still not "conform to
> XDG."  Unless someone *else* has a good use for a multi-element ZDOTDIR
> path, there's no benefit in going down this road.

Presumably if you wanted your distribution to conform to it you'd stick
the setting in /etc/zshenv, with appropriate protections.  I expect we'd
have to issue guidelines if we went down this route since there are still
plenty of pitfalls.

Mikael wrote:
> I have my dotfiles in ~/.zsh, but .zshrc linked to ~ so I can edit it
> easily (I tend to do that a lot), so parsing both by default would be
> bad for me.

Whatever the rule we came up with was, I'm sure there'd be a way of
dealing with this.

Either look for the first existing directory.  (So it wouldn't be
sensible to have $HOME anywhere other than at the end.)

Or look down $zdotdir for the first existing dot file and
stick with that directory for all files.  (Probably needs special
handling if zdotdir gets changed.)

Or look for the first dot file of each type separately down $zdotdir.  This
is the simplest solution but could have counterintuitive results if you
leave an old file behind in $HOME and subsequently only ever look at
the files in ~/.zsh or wherever.

There doesn't seem any good reason for handling multiple files of the same type within $zdotdir (i.e. .zshrc etc. in two different places), there are already plenty of good ways of chaining files.

We might need to think about rules for finding e.g. ~/.zsh/zshrc instead of
~/.zsh/.zshrc since the extra dot is pretty unhelpful.  (E.g. look for
the file without the dot if a parent directory does have a dot at the
start.  We don't want to look for ~/zshrc, that could easily be problematic.)

If there's no real enthusiasm, however, it's not worth pursuing.

Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/

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