From: Amol Deshpande <amold@MICROSOFT.com>
To: zsh-users@math.gatech.edu, "'Bart Schaefer'" <schaefer@brasslantern.com>
Subject: RE: zsh for win32 - installation of zshrc
Date: Wed, 16 Sep 1998 16:08:22 -0700 [thread overview]
Message-ID: <AF4C1F8C5306D111AD5F0000F8662ED3053088C7@RED-MSG-41> (raw)
i put in code to hash foo.exe as foo as well as foo.exe
bogus corrections should be reduced a bit by this.
(check for version 0.50)
thanks,
-amol
> ----------
> From: Bart Schaefer[SMTP:schaefer@brasslantern.com]
> Sent: Tuesday, September 15, 1998 5:55 PM
> To: zsh-users@math.gatech.edu
> Subject: Re: zsh for win32 - installation of zshrc
>
> On Sep 15, 2:56pm, Amol Deshpande wrote:
> > >
> > > "setopt correct" is worthless because it uses the full file name (e.g.
> > > "foo.exe") when trying to correct the spelling of a command ("foo")
> and
> > > therefore complains about nearly everything except builtins. (This is
> > > probably fixable by playing with hash/unhash commands.)
> > >
> > it's actually fixable by just renaming all your foo.exes to foo :-)
>
> I wrote this little fragment of code to fix it (still not handling all
> the possible extensions, just .exe):
>
> function fixhash {
> emulate -R zsh
> setopt localoptions
> local hashed exe
> hash -f
> eval hashed=\( $(hash) \)
> exe=( ${(M)hashed:#*.[Ee][Xx][Ee]\=*} )
> hashed=( ${hashed%%\=*} )
> hashed=( ${hashed:#*.[Ee][Xx][Ee]} )
> hashed=( ${(M)hashed:#*.*} )
> [[ $#hashed -gt 0 ]] && unhash $hashed
> [[ $#exe -gt 0 ]] && hash ${exe:l:s/.exe//}
> }
>
> However, running that function takes a LONG time and then crashes the
> shell.
> Right before the shell crashes, the $hashed array is 1349 elements long
> and
> contains just over 16000 bytes.
>
> If I don't put the commands in a function, simply type everything from the
> "hash -f" to the end directly at the PS1 prompt (or put it in .zshrc),
> then
> it still takes a long time -- particularly "eval hashed=\( $(hash) \)" --
> but the shell doesn't crash.
>
> > For example, HOMDRIVE=F:, and HOMEPATH=\
> > so, if FOO=$HOMEDRIVE$HOMEPATH, then FOO is set
> > to F:\.
> >
> > this will confuse the shell no end (all paths MUST be '/'-delimited)
>
> Hmm, that's interesting. Right now I have HOME=d:\home\schaefer and I
> don't have winntconvertbackslash and the shell seems to be doing fine.
> (Everything in $PATH is forward-slash-delimited, though.)
>
> > in tcsh i could just do
> >
> > set bar=$var:s#\\#/#:ah
> >
> > but I was told there was no simple way in zsh to do the same.
>
> bar=${var:gs@\\@/@}
>
> works fine. Going the other way is trickier:
>
> var=${bar:gs@/@\\\\@}
>
> I don't know why the extra two backslashes are needed. Anyone?
>
> > BTW, please don't cc amol@blarg.net.
>
> Sorry; my UA copied the Cc: from your own headers. (I've been deleting
> amold@microsoft.com from the To: header by hand).
>
next reply other threads:[~1998-09-16 23:16 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-09-16 23:08 Amol Deshpande [this message]
-- strict thread matches above, loose matches on Subject: below --
1998-09-15 21:56 Amol Deshpande
1998-09-16 0:55 ` Bart Schaefer
1998-09-15 18:04 Amol Deshpande
1998-09-15 18:00 Amol Deshpande
1998-09-15 20:59 ` Bart Schaefer
1998-09-15 21:40 ` Bart Schaefer
[not found] <c=GB%a=_%p=Saudi_Internatio%l=SMS01-980911172557Z-1926@sms01.saudibank.com>
1998-09-12 5:43 ` 'Sven Guckes'
1998-09-12 6:53 ` Bart Schaefer
1998-09-14 17:55 ` 'Sven Guckes'
1998-09-14 20:59 ` Amol Deshpande
1998-09-14 18:40 ` Amol Deshpande
1998-09-14 19:54 ` Bart Schaefer
1998-09-14 23:53 ` 'Sven Guckes'
1998-09-15 0:52 ` Amol Deshpande
1998-09-15 2:19 ` 'Sven Guckes'
1998-09-15 6:31 ` Amol Deshpande
1998-09-15 12:52 ` David N. Blank-Edelman
1998-09-15 17:08 ` Stephen Marley
1998-09-16 12:20 ` Hannu Koivisto
1998-09-16 13:26 ` Stephen Marley
1998-09-17 10:48 ` Hannu Koivisto
1998-09-16 15:32 ` Bart Schaefer
1998-09-15 17:18 ` Bart Schaefer
1998-09-11 18:27 Amol Deshpande
1998-09-11 16:41 Sven Guckes
1998-09-11 17:13 ` Stephen Rondeau
1998-09-11 20:11 ` ric hotchkiss
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=AF4C1F8C5306D111AD5F0000F8662ED3053088C7@RED-MSG-41 \
--to=amold@microsoft.com \
--cc=schaefer@brasslantern.com \
--cc=zsh-users@math.gatech.edu \
/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).