zsh-users
 help / color / mirror / code / Atom feed
* cd && cdable_vars (bug?)
@ 2006-03-29 11:46 Francisco Borges
  2006-03-29 18:09 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Francisco Borges @ 2006-03-29 11:46 UTC (permalink / raw)
  To: Zsh User

Hello everybody!

Here am I again, nitpicking on zsh...

8-)

Two questions/comments about cd and cdable_vars:

1. I have cdable_vars set and I do have some data directories with
   "integer" names: 2, 3, 5.

   When trying to complete on these dirs, I get not only the dirs I'm
   supposed to get (those inside directory "5/.") but I also get all
   subdirs of the fifth entry in my dirstack as "directory after
   cdablevar".

   Which AFAIK should not happen, since there is a directory "5", so
   there should be no cdablevar lookup, right?

2. The first problem lead me to try completing on cdablevars from the
   dirstack. This is *not* something I would like to do, but I tried
   motivated by the noise when completing.

   And it failed! But it shouldn't, right?

   CDABLE_VARS (-T): ...try to expand the expression as if it were
   preceded by a `~'...

   With a filled dirstack, using

   % cd ~5 	 # takes me to the corresponding entry in the dirstack,
   % expand ~5 	 # expands to some dir...
   % cd 5   	 # fails with cdablevars set.

Cheers!
Francisco


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: cd && cdable_vars (bug?)
  2006-03-29 11:46 cd && cdable_vars (bug?) Francisco Borges
@ 2006-03-29 18:09 ` Bart Schaefer
  2006-03-29 19:40   ` Francisco Borges
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2006-03-29 18:09 UTC (permalink / raw)
  To: Zsh User

On Mar 29,  1:46pm, Francisco Borges wrote:
}
} Two questions/comments about cd and cdable_vars:
} 
} 1. I have cdable_vars set and I do have some data directories with
}    "integer" names: 2, 3, 5.
} 
}    When trying to complete on these dirs, I get not only the dirs I'm
}    supposed to get (those inside directory "5/.") but I also get all
}    subdirs of the fifth entry in my dirstack as "directory after
}    cdablevar".

That looks like a bug in _cd.  It should be getting handled by _tilde
and classified as "directory-stack".
 
}    Which AFAIK should not happen, since there is a directory "5", so
}    there should be no cdablevar lookup, right?

That's probably true, but it may depend on your other completion settings.
Completion usually errs on the side of giving you too many choices, when
there is ambiguity.
 
} 2. The first problem lead me to try completing on cdablevars from the

Do you mean "completing" here, or do you mean executing "cd"?

}    dirstack. This is *not* something I would like to do, but I tried
}    motivated by the noise when completing.
} 
}    And it failed! But it shouldn't, right?

I think the doc for CDABLE_VARS predates the ability to refer to dirstack
entries with tilde-notation ... "as if it were preceded by a `~'" really
means "look it up in the named directories table and use the value of the
parameter".  Since "3" is not really a parameter ...  Anyway, I believe
this is a case of the implementation outrunning the doc.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: cd && cdable_vars (bug?)
  2006-03-29 18:09 ` Bart Schaefer
@ 2006-03-29 19:40   ` Francisco Borges
  0 siblings, 0 replies; 3+ messages in thread
From: Francisco Borges @ 2006-03-29 19:40 UTC (permalink / raw)
  To: Zsh User

» On Wed, Mar 29, 2006 at 10:09AM -0800, Bart Schaefer wrote:

> }    Which AFAIK should not happen, since there is a directory "5", so
> }    there should be no cdablevar lookup, right?
>
> That's probably true, but it may depend on your other completion settings.
> Completion usually errs on the side of giving you too many choices, when
> there is ambiguity.

No, there is no ambiguity (cdablevars should only work when there is no
dir with that name) and, in any case, these choices are spurious in the
sense that, if accepted and executed, they fail (just like cd <int>
won't expand to cd ~<int>).

This will happen with clean "completion styles"

zsh -f

autoload -U compinit
compinit -D -C

setopt cdable_vars

mkdir -p test_cd
cd test_cd

dirstack=(/etc /usr /var)

mkdir -p 2/a 2/b 2/c

loki% cd 2/[TAB]
a/           c/           games/       lib/         lost+found/  share/
b/           dict@        include/     lib64/       openwin@     src/

loki% cd 2/bin
cd: no such file or directory: 2/bin

Cheers,
Francisco


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-03-29 19:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-29 11:46 cd && cdable_vars (bug?) Francisco Borges
2006-03-29 18:09 ` Bart Schaefer
2006-03-29 19:40   ` Francisco Borges

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).