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

Re: about beta11



-----BEGIN PGP SIGNED MESSAGE-----

>One of the things I'm doing for beta11 is splitting the hash table
>cmdnamtab into three separate tables for shell functions, builtins,
>and external commands.  This fixes some of the weird command name
>space problems that would have been difficult to fix any other way.

Does this mean that command completion, equals substitution and the
hash builtin will all agree on whether a command exists?

>1) enable/disable by default will only work on builtin functions
>2) enable -f, disable -f will enable/disable shell functions
>3) enable -r, disable -r will enable/disable reserved words

Great.  Atm, one can disable functions, but not reserved words or
external commands (though they will be added to the disable list), but
can't enable anything other than a builtin.  It's all rather silly.

>4) unhash by default will only unhash external commands.
>5) unhash -f will remove shell functions.  unfunction is now
>   just an alias for unhash -f.
>6) unhash -a will remove aliases.  unalias is now just an
>   alias for unhash -a.

Neat.

>Zefram, were you the one that wrote the code for named directories?

Some of it, yes.  hash/rehash -d is my code.

>Is there anything preventing us from using a hash table for this
>rather than a linked list (which is what it currently uses)?

'fraid so.  The named directory table is sorted.  (Actually, I'm pretty
sure it's a big array, not a linked list, hence the occasional comment
that calls it a hash table even though there's no real hashing
involved.)  It has to be sorted so that %~ in prompts gives the
shortest possible name for the directory.  That capability isn't used
anywhere else, but unless you have a brilliant way to do that with a
hash table then hash -d will have to stay as an exception.

I think it might make the builtins a bit neater if hash/rehash -d, and
unhash -d if it gets added (it should be), were handled by separate
functions from the normal bin_{,re,un}hash.  There would be a statement
"if(ops['d']) return dir_hash(whatever)" at the beginning of each
bin_*hash function, and the rest of the function would be the normal
hash table stuff.

It *might* also be good to merge bin_hash and bin_rehash, and have
rehash merely as an alias to hash -r.  It should be documented that way
anyway.

Speaking of builtin aliases, is "where" (whence -ca) going to appear at
some point?  I sent a one-line patch for it, and Zoltan's release has
that patch plus documentation.  It is genuinely useful to have a
builtin that does a whence -a (I alias it).  And has anyone considered
adding the csh "glob" command, which would be something like "print
 -rN"?  (Less useful, but it occurred to me as being appropriate.  Does
anyone use glob these days?)

At this point I was going to request that the remaining disgusting bits
of inconsistent ! quoting be fixed, as Zoltan's release contains a
patch to make it just a normal character.  That was certainly the case
a few betas ago.  But then I tested, just to make sure:

% echo $ZSH_VERSION
2.6-beta10
% echo \\!
!
% # Double escaping.  Ugh.
% zshz
% echo $ZSH_VERSION
2.6-beta10-hzoli10.1
% echo \\!
zsh: Oops. You discovered a bug in hungetc

I'd love to see this quoting mess sorted out -- once Zoltan has the
above problem sorted out.  In any case, the man page that says that SQs
will not quote !s is now wrong, thankfully.

Finally, I remember there being a very simple (two line) patch that
made AUTO_REMOVE_SLASH remove an automatically added slash if the next
character typed is a slash, as well as if it's a newline.  I think the
consensus was in favour of it being used.  (Its purpose is to stop a
menu completion on a directory name and continue completion on
pathnames under that directory, without having to add a character and
then delete it again.)  Could this be put into the next release?

 -zefram

-----BEGIN PGP SIGNATURE-----
Version: 2.6.i

iQBVAgUBMAdJmWWJ8JfKi+e9AQE/YQH/c5iqTbPjMSspjJpEbNs5k2ISMQsPrqhC
/xwa4454BkftZFxL4HBoBY7K2GrJ/l5J8zSX0SK024ja14NZJei/Sw==
=d3Hs
-----END PGP SIGNATURE-----



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