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

Re: BUG: locals remove setopt autonamedirs



I don't think this is Charles' bug. I think the following is perfectly reasonable:

% setopt autonamedirs    # Enable AND to benefit from standard parameters like JAVA_HOME
% hash -d n=/n/path ...  # Define custom named directories that don't clutter $<TAB> completions
% foo ...                # Call functions from any imported library without fear that your custom directories will get erased

Currently if the function "foo" happens to declare a local string parameter named "n", the custom named directory "n" will be erased (independent of what value "foo" assigns to "n" and whether "foo" intended to create a named directory or not). That, to me, looks very much like a Zsh bug or at least an AND bug.

Philippe


On Tue, Apr 7, 2026 at 6:47 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
On Tue, Apr 7, 2026 at 9:33 AM Philippe Altherr
<philippe.altherr@xxxxxxxxx> wrote:
>
> Here is a patch that restricts AND to global parameters

I don't strongly object to this, but I'm not particularly in favor of it either.

I'm firmly of the opinion that this is entirely Charles' "bug", not
zsh's.  He should not be using both autonamedirs and `hash -d` at the
same time.  The latter is IMO intended for enabling the named
directories feature without forcing you to map parameters into the
table.  Also enabling automatic parameter mapping is simply asking for
it to break.

However, I'm in favor of including noautonamedirs in the completion
options, I was surprised to realize it was not there already.  Note
this is desirable regardless of which way we go with Philippe's patch,
because a completion function might use `typeset -g` to pass state
from one iteration to the next.



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