zsh-users
 help / color / mirror / code / Atom feed
* Tilde expansion and completion again
@ 2004-11-04 10:52 DervishD
  2004-11-04 11:00 ` Peter Stephenson
  2004-11-04 16:25 ` Bart Schaefer
  0 siblings, 2 replies; 5+ messages in thread
From: DervishD @ 2004-11-04 10:52 UTC (permalink / raw)
  To: Zsh Users

    Hi all :)

    This is short: why aren't PWD and OLDPWD stored in $nameddirs
until a 'cd' command is issued? Why aren't the rest of parameters
whose value starts with a slash stored directly in $nameddirs
withouth the need to call 'hash -d'?

    Thanks a lot in advance :)

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736
http://www.dervishd.net & http://www.pleyades.net/


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

* Re: Tilde expansion and completion again
  2004-11-04 10:52 Tilde expansion and completion again DervishD
@ 2004-11-04 11:00 ` Peter Stephenson
  2004-11-04 11:58   ` DervishD
  2004-11-04 16:25 ` Bart Schaefer
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Stephenson @ 2004-11-04 11:00 UTC (permalink / raw)
  To: Zsh Users

DervishD wrote:
>     This is short: why aren't PWD and OLDPWD stored in $nameddirs
> until a 'cd' command is issued? Why aren't the rest of parameters
> whose value starts with a slash stored directly in $nameddirs
> withouth the need to call 'hash -d'?

setopt autonamedirs

(you need to cd at least once afterwards for it to spot the change).

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


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

* Re: Tilde expansion and completion again
  2004-11-04 11:00 ` Peter Stephenson
@ 2004-11-04 11:58   ` DervishD
  0 siblings, 0 replies; 5+ messages in thread
From: DervishD @ 2004-11-04 11:58 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh Users

    Hi Peter :)

 * Peter Stephenson <pws@csr.com> dixit:
> >     This is short: why aren't PWD and OLDPWD stored in $nameddirs
> > until a 'cd' command is issued? Why aren't the rest of parameters
> > whose value starts with a slash stored directly in $nameddirs
> > withouth the need to call 'hash -d'?
> setopt autonamedirs
> (you need to cd at least once afterwards for it to spot the change).

    I had it set, and my problem is exactly that: I must issue a cd
once to get them stored :( That means that some of my completion code
won't work as expected if I don't do a cd :(

    I'll do a 'cd .' in the completion widget or I'll make sure I
have done the 'hash -d' in my RC files. Thanks a lot for your help :))

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736
http://www.dervishd.net & http://www.pleyades.net/


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

* Re: Tilde expansion and completion again
  2004-11-04 10:52 Tilde expansion and completion again DervishD
  2004-11-04 11:00 ` Peter Stephenson
@ 2004-11-04 16:25 ` Bart Schaefer
  2004-11-04 18:16   ` DervishD
  1 sibling, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2004-11-04 16:25 UTC (permalink / raw)
  To: Zsh Users

On Thu, 4 Nov 2004, DervishD wrote:

>     This is short: why aren't PWD and OLDPWD stored in $nameddirs
> until a 'cd' command is issued?

Peter told you the workaround, but he didn't answer "why".

The effect of autonamedirs is that the parameter becomes a named directory 
when a string beginning with a slash is assigned to it.

In the cases of PWD, OLDPWD, and nearly all other variables "known to the 
shell" their values have already been assigned long before autonamedirs 
can become set in your rc files.  Therefore they don't become nameddirs 
until the _next_ time they are assigned (which for PWD and OLDPWD is upon 
the next "cd"), or when nameddirs are forcibly rebuilt with "hash -d".

> Why aren't the rest of parameters whose value starts with a slash stored 
> directly in $nameddirs withouth the need to call 'hash -d'?

Because it's not the job of the "setopt" command to track down and tickle 
all possible side effects of the options that you've told it to change.
And if you think about it, you wouldn't want it to even if it could.


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

* Re: Tilde expansion and completion again
  2004-11-04 16:25 ` Bart Schaefer
@ 2004-11-04 18:16   ` DervishD
  0 siblings, 0 replies; 5+ messages in thread
From: DervishD @ 2004-11-04 18:16 UTC (permalink / raw)
  To: zsh-users

    Hi Bart :)

 * Bart Schaefer <schaefer@brasslantern.com> dixit:
> >     This is short: why aren't PWD and OLDPWD stored in $nameddirs
> > until a 'cd' command is issued?
> Peter told you the workaround, but he didn't answer "why".
[...]
> In the cases of PWD, OLDPWD, and nearly all other variables "known to the 
> shell" their values have already been assigned long before autonamedirs 
> can become set in your rc files.  Therefore they don't become nameddirs 
> until the _next_ time they are assigned (which for PWD and OLDPWD is upon 
> the next "cd"), or when nameddirs are forcibly rebuilt with "hash -d".

    Ok, now I have it clear :) Thanks a lot, Bart.
 
> > Why aren't the rest of parameters whose value starts with a slash stored 
> > directly in $nameddirs withouth the need to call 'hash -d'?
> Because it's not the job of the "setopt" command to track down and tickle 
> all possible side effects of the options that you've told it to change.
> And if you think about it, you wouldn't want it to even if it could.

    I don't want setopt to do the job, but zsh itself as soon as the
values are stored. The problem is the autonamedirs option, because
this cannot be done unless it is on.

    Well, the 'hash -d' method is more flexible.
 
    Thanks again Bart :)

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736
http://www.dervishd.net & http://www.pleyades.net/


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

end of thread, other threads:[~2004-11-04 18:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-04 10:52 Tilde expansion and completion again DervishD
2004-11-04 11:00 ` Peter Stephenson
2004-11-04 11:58   ` DervishD
2004-11-04 16:25 ` Bart Schaefer
2004-11-04 18:16   ` DervishD

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