* PWS :reload @ 2005-05-12 12:11 zzapper 2005-05-12 13:02 ` Peter Stephenson 0 siblings, 1 reply; 12+ 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] 12+ 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; 12+ 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] 12+ 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; 12+ 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] 12+ messages in thread
[parent not found: <david@tvis.co.uk>]
* Re: PWS :reload [not found] ` <david@tvis.co.uk> @ 2005-05-12 14:48 ` Peter Stephenson 2005-05-12 16:00 ` zzapper 2005-05-17 13:00 ` echo $fred:s/str1/str2/ Peter Stephenson 1 sibling, 1 reply; 12+ 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] 12+ 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; 12+ 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] 12+ 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; 12+ 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] 12+ messages in thread
* Re: PWS :reload 2005-05-12 17:05 ` Bart Schaefer @ 2005-05-12 17:26 ` zzapper 0 siblings, 0 replies; 12+ 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] 12+ messages in thread
* Re: echo $fred:s/str1/str2/ [not found] ` <david@tvis.co.uk> 2005-05-12 14:48 ` Peter Stephenson @ 2005-05-17 13:00 ` Peter Stephenson 2005-05-17 15:30 ` zzapper 1 sibling, 1 reply; 12+ messages in thread From: Peter Stephenson @ 2005-05-17 13:00 UTC (permalink / raw) To: zsh-users zzapper wrote: > echo $fred:s/bu/hhh/ > > I don't seem to be able to use regexp's in the substitute tho' it's suggested > that it's possible in > the doc You can't use patterns with that form, which is the history modifier syntax. You can use patterns with this form: echo ${fred/bu/hhh} A useful trick with this form if you need to manipulate the matched part is to use the (#m) extended globbing flag and the $MATCH variable: % fred="hello harry" % print ${fred//(#m)[aeiou]/${(U)MATCH}} hEllO hArry 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] 12+ messages in thread
* Re: echo $fred:s/str1/str2/ 2005-05-17 13:00 ` echo $fred:s/str1/str2/ Peter Stephenson @ 2005-05-17 15:30 ` zzapper 2005-05-17 16:08 ` Peter Stephenson 0 siblings, 1 reply; 12+ messages in thread From: zzapper @ 2005-05-17 15:30 UTC (permalink / raw) To: zsh-users On Tue, 17 May 2005 14:00:18 +0100, wrote: > >You can't use patterns with that form, which is the history modifier >syntax. You can use patterns with this form: > >echo ${fred/bu/hhh} > Peter, I was expecting to use PCRE but it seems to only allow simplified patterns echo ${fred/ket*ll/yyy} Where can I find the rules? -- 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] 12+ messages in thread
* Re: echo $fred:s/str1/str2/ 2005-05-17 15:30 ` zzapper @ 2005-05-17 16:08 ` Peter Stephenson 2005-05-17 18:02 ` zzapper 0 siblings, 1 reply; 12+ messages in thread From: Peter Stephenson @ 2005-05-17 16:08 UTC (permalink / raw) To: zsh-users zzapper wrote: > On Tue, 17 May 2005 14:00:18 +0100, wrote: > >You can't use patterns with that form, which is the history modifier > >syntax. You can use patterns with this form: > > > >echo ${fred/bu/hhh} > > > Peter, > I was expecting to use PCRE but it seems to only allow simplified patterns > > echo ${fred/ket*ll/yyy} > > Where can I find the rules? They are standard shell globbing patterns, as described in the "Filename Generation" section of the zshexpn manual. This is the only form of pattern matching the standard shell syntax knows about. You certainly shouldn't be expecting to use PCRE. That's never part of standard shell syntax. It's only invoked in a few particular cases loaded explicitly with the zsh/pcre module. -- 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] 12+ messages in thread
* Re: echo $fred:s/str1/str2/ 2005-05-17 16:08 ` Peter Stephenson @ 2005-05-17 18:02 ` zzapper 0 siblings, 0 replies; 12+ messages in thread From: zzapper @ 2005-05-17 18:02 UTC (permalink / raw) To: zsh-users On Tue, 17 May 2005 17:08:53 +0100, wrote: >zzapper wrote: >> On Tue, 17 May 2005 14:00:18 +0100, wrote: >> >You can't use patterns with that form, which is the history modifier >> >syntax. You can use patterns with this form: >> > >> >echo ${fred/bu/hhh} >> > >> Peter, >> I was expecting to use PCRE but it seems to only allow simplified patterns >> >> echo ${fred/ket*ll/yyy} >> >> Where can I find the rules? > >They are standard shell globbing patterns, as described in the "Filename >Generation" section of the zshexpn manual. This is the only form of >pattern matching the standard shell syntax knows about. > >You certainly shouldn't be expecting to use PCRE. That's never part of >standard shell syntax. It's only invoked in a few particular cases >loaded explicitly with the zsh/pcre module. thx found the right part of help now -- 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] 12+ messages in thread
* echo $fred:s/str1/str2/ @ 2005-05-17 12:31 zzapper 0 siblings, 0 replies; 12+ messages in thread From: zzapper @ 2005-05-17 12:31 UTC (permalink / raw) To: zsh-users Hi, echo $fred:s/bu/hhh/ I don't seem to be able to use regexp's in the substitute tho' it's suggested that it's possible in the doc Tell me how wrong I am!?1 -- 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] 12+ messages in thread
end of thread, other threads:[~2005-05-17 18:08 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 2005-05-17 13:00 ` echo $fred:s/str1/str2/ Peter Stephenson 2005-05-17 15:30 ` zzapper 2005-05-17 16:08 ` Peter Stephenson 2005-05-17 18:02 ` zzapper 2005-05-17 12:31 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).