zsh-users
 help / color / mirror / code / Atom feed
* PWS: reload
@ 2005-07-20 15:10 zzapper
  2005-07-20 15:52 ` Peter Stephenson
  0 siblings, 1 reply; 10+ messages in thread
From: zzapper @ 2005-07-20 15:10 UTC (permalink / raw)
  To: zsh-users

PWS,

It'd be really useful if your reload function would "find" the script whereever it might lie in the
path.
I've tried the
autoload =somescript but it doesn't seem to work.
-- 
zzapper
vim -c ":%s%s*%Cyrnfr)fcbafbe[Oenz(Zbbyranne%|:%s)[[()])-)Ig|norm Vg?"
http://www.rayninfo.co.uk/tips/ vim, zsh & success tips


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

* Re: PWS: reload
  2005-07-20 15:10 PWS: reload zzapper
@ 2005-07-20 15:52 ` Peter Stephenson
  2005-07-20 16:08   ` zzapper
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Stephenson @ 2005-07-20 15:52 UTC (permalink / raw)
  To: zsh-users

zzapper wrote:
> It'd be really useful if your reload function would "find" the script whereev
> er it might lie in the
> path.
> I've tried the
> autoload =somescript but it doesn't seem to work.

reload doesn't work on scripts, it works on functions.

It doesn't matter where the function lives in the path; you don't refer to
it by the full path anyway, just the function name.

Functions doen't live in $path, like scripts, they live in $fpath, so =
won't find them.

pws


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

**********************************************************************


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

* Re: PWS: reload
  2005-07-20 15:52 ` Peter Stephenson
@ 2005-07-20 16:08   ` zzapper
  0 siblings, 0 replies; 10+ messages in thread
From: zzapper @ 2005-07-20 16:08 UTC (permalink / raw)
  To: zsh-users

On Wed, 20 Jul 2005 16:52:01 +0100,  wrote:

>zzapper wrote:
>> It'd be really useful if your reload function would "find" the script whereev
>> er it might lie in the
>> path.
>> I've tried the
>> autoload =somescript but it doesn't seem to work.
>
>reload doesn't work on scripts, it works on functions.
>
>It doesn't matter where the function lives in the path; you don't refer to
>it by the full path anyway, just the function name.
>
>Functions doen't live in $path, like scripts, they live in $fpath, so =
>won't find them.
>

Sorry PWS
AYS it does work from "anywhere", isn't it frustrating when one jumps to a conclusion!!
>

-- 
zzapper
vim -c ":%s%s*%Cyrnfr)fcbafbe[Oenz(Zbbyranne%|:%s)[[()])-)Ig|norm Vg?"
http://www.rayninfo.co.uk/tips/ vim, zsh & success tips


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

* Re: PWS :reload
  2005-05-12 17:05           ` Bart Schaefer
@ 2005-05-12 17:26             ` zzapper
  0 siblings, 0 replies; 10+ messages in thread
From: zzapper @ 2005-05-12 17:26 UTC (permalink / raw)
  To: zsh-users

On Thu, 12 May 2005 17:05:51 +0000,  Bart wrote:

>
>We're venturing into the realm of "you should be able to do this yourself."
Richtig aber,  as reload is I believe of general interest I though this way we'd get the best
version!

function reload() {
# reload your changed autoloaded function(s)
if (( $# == 0 ));
then
    print "Reload what?" >&2
    return 1
fi
while (( $# )); do
    unfunction $1 2>/dev/null || print -u2 "$1 loading for the first time"
    autoload $1
    shift
done
}
-- 
zzapper
vim -c ":%s%s*%Cyrnfr)fcbafbe[Oenz(Zbbyranne%|:%s)[[()])-)Ig|norm Vg?"
http://www.rayninfo.co.uk/tips/ vim, zsh & success tips


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

* Re: PWS :reload
  2005-05-12 16:00         ` zzapper
@ 2005-05-12 17:05           ` Bart Schaefer
  2005-05-12 17:26             ` zzapper
  0 siblings, 1 reply; 10+ messages in thread
From: Bart Schaefer @ 2005-05-12 17:05 UTC (permalink / raw)
  To: zsh-users

On May 12,  5:00pm, zzapper wrote:
}
} >reload() {
} >while (( $# )); do
} >  unfunction $1 2>/dev/null
} >  autoload $1
} >  shift
} >done
} >}
} >
} Can I have a warning that the function wasn't already loaded?

We're venturing into the realm of "you should be able to do this yourself."

E.g., just take out the 2>/dev/null

Or:

reload() {
while (( $# )); do
  unfunction $1 2>/dev/null || print -u2 "$1 loading for the first time"
  autoload $1
  shift
done

Or whatever ...


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

* Re: PWS :reload
  2005-05-12 14:48       ` Peter Stephenson
@ 2005-05-12 16:00         ` zzapper
  2005-05-12 17:05           ` Bart Schaefer
  0 siblings, 1 reply; 10+ messages in thread
From: zzapper @ 2005-05-12 16:00 UTC (permalink / raw)
  To: zsh-users

On Thu, 12 May 2005 15:48:28 +0100,  wrote:

>zzapper wrote:
>> I never remember that I need to say autoload the first time of use that's all
>> .
>
>You might want to ignore the result of unfunction.
>
>reload() {
>while (( $# )); do
>  unfunction $1 2>/dev/null
>  autoload $1
>  shift
>done
>}
>
Can I have a warning that the function wasn't already loaded?

-- 
zzapper
vim -c ":%s%s*%Cyrnfr)fcbafbe[Oenz(Zbbyranne%|:%s)[[()])-)Ig|norm Vg?"
http://www.rayninfo.co.uk/tips/ vim, zsh & success tips


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

* Re: PWS :reload
       [not found]     ` <david@tvis.co.uk>
@ 2005-05-12 14:48       ` Peter Stephenson
  2005-05-12 16:00         ` zzapper
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Stephenson @ 2005-05-12 14:48 UTC (permalink / raw)
  To: zsh-users

zzapper wrote:
> I never remember that I need to say autoload the first time of use that's all
> .

You might want to ignore the result of unfunction.

reload() {
while (( $# )); do
  unfunction $1 2>/dev/null
  autoload $1
  shift
done
}

or something.

pws


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

**********************************************************************


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

* Re: PWS :reload
  2005-05-12 13:02 ` Peter Stephenson
@ 2005-05-12 13:59   ` zzapper
       [not found]     ` <david@tvis.co.uk>
  0 siblings, 1 reply; 10+ messages in thread
From: zzapper @ 2005-05-12 13:59 UTC (permalink / raw)
  To: zsh-users

On Thu, 12 May 2005 14:02:03 +0100,  wrote:

>zzapper wrote:
>> Peter,
>> I'd like a version of your excellent reload script which doesn't fail if the 
>> script has just been
>> created thx.
>
>It's for functions, not scripts.  I don't know what feature you're
>talking about; it works fine if the function is already marked for
>autoloading.  Do you mean you want to be able either to autoload or
>reload with the same function?  You can use "autoload foo; reload foo".

P,
I never remember that I need to say autoload the first time of use that's all.


-- 
zzapper
vim -c ":%s%s*%Cyrnfr)fcbafbe[Oenz(Zbbyranne%|:%s)[[()])-)Ig|norm Vg?"
http://www.rayninfo.co.uk/tips/ vim, zsh & success tips


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

* Re: PWS :reload
  2005-05-12 12:11 PWS :reload zzapper
@ 2005-05-12 13:02 ` Peter Stephenson
  2005-05-12 13:59   ` zzapper
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Stephenson @ 2005-05-12 13:02 UTC (permalink / raw)
  To: Zsh users list

zzapper wrote:
> Peter,
> I'd like a version of your excellent reload script which doesn't fail if the 
> script has just been
> created thx.

It's for functions, not scripts.  I don't know what feature you're
talking about; it works fine if the function is already marked for
autoloading.  Do you mean you want to be able either to autoload or
reload with the same function?  You can use "autoload foo; reload foo".

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

**********************************************************************


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

* PWS :reload
@ 2005-05-12 12:11 zzapper
  2005-05-12 13:02 ` Peter Stephenson
  0 siblings, 1 reply; 10+ messages in thread
From: zzapper @ 2005-05-12 12:11 UTC (permalink / raw)
  To: zsh-users

Peter,
I'd like a version of your excellent reload script which doesn't fail if the script has just been
created thx.
.


-- 
zzapper
vim -c ":%s%s*%Cyrnfr)fcbafbe[Oenz(Zbbyranne%|:%s)[[()])-)Ig|norm Vg?"
http://www.rayninfo.co.uk/tips/ vim, zsh & success tips


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

end of thread, other threads:[~2005-07-20 16:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-20 15:10 PWS: reload zzapper
2005-07-20 15:52 ` Peter Stephenson
2005-07-20 16:08   ` zzapper
  -- strict thread matches above, loose matches on Subject: below --
2005-05-12 12:11 PWS :reload zzapper
2005-05-12 13:02 ` Peter Stephenson
2005-05-12 13:59   ` zzapper
     [not found]     ` <david@tvis.co.uk>
2005-05-12 14:48       ` Peter Stephenson
2005-05-12 16:00         ` zzapper
2005-05-12 17:05           ` Bart Schaefer
2005-05-12 17:26             ` zzapper

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