zsh-users
 help / color / mirror / code / Atom feed
* zmodload zmv ?
@ 2002-03-19 23:29 Nick Croft
  2002-03-19 23:43 ` Bart Schaefer
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Nick Croft @ 2002-03-19 23:29 UTC (permalink / raw)
  To: zsh-users

zmv looks to be a very handy utility. With Debian, it's located
under /usr/share/zsh/4.0.4/functions/Misc  .

I've tried starting it with zmodload zmv - nothing.

I've moved, chowned, and chmodded it to a local fpath.

What's the trick? All the googling points to the same paragraph being
quoted. The source contains a pretty good description of its uses but no
hint as to startup.

It tries to do something if I explicitly quote the path in the command
line. But emulating the example produced the following

        nicko@work ~/tmp % ../.myfns/zmv '(*).bmp '$1.BMP'
        ../.myfns/zmv: emulate: command not found
        ../.myfns/zmv: local can only be used in a function
        ../.myfns/zmv: typeset: unknown option: `-A'
        ../.myfns/zmv: integer: command not found
        ../.myfns/zmv: setopt: command not found

I imagine those calls would work without problems if it could be loaded 
with zmodload.

Nick


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

* Re: zmodload zmv ?
  2002-03-19 23:29 zmodload zmv ? Nick Croft
@ 2002-03-19 23:43 ` Bart Schaefer
  2002-03-19 23:46 ` Phil Pennock
  2002-03-19 23:47 ` Dennis Haney
  2 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2002-03-19 23:43 UTC (permalink / raw)
  To: Nick Croft; +Cc: zsh-users

On Wed, 20 Mar 2002, Nick Croft wrote:

> I've tried starting it with zmodload zmv - nothing.

zmodload is for shared library objects, not shell functions.  You want
`autoload zmv'.

Try "man zshcontrib", or "info zsh" and look at the "User Contributions"
section.

>         nicko@work ~/tmp % ../.myfns/zmv '(*).bmp '$1.BMP'
>         ../.myfns/zmv: emulate: command not found

At a guess, running it as a shell script is trying to feed it to /bin/sh
rather than to /bin/zsh, which simply won't work.


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

* Re: zmodload zmv ?
  2002-03-19 23:29 zmodload zmv ? Nick Croft
  2002-03-19 23:43 ` Bart Schaefer
@ 2002-03-19 23:46 ` Phil Pennock
  2002-03-19 23:47 ` Dennis Haney
  2 siblings, 0 replies; 5+ messages in thread
From: Phil Pennock @ 2002-03-19 23:46 UTC (permalink / raw)
  To: Nick Croft; +Cc: zsh-users

On 2002-03-20 at 10:29 +1100, Nick Croft wrote:
> zmv looks to be a very handy utility. With Debian, it's located
> under /usr/share/zsh/4.0.4/functions/Misc  .
> 
> I've tried starting it with zmodload zmv - nothing.

zmodload is for loading dynamic code into zsh.  For your platform, ".so"
files.

"man zshmodules"

> I've moved, chowned, and chmodded it to a local fpath.

fpath/FPATH is searched for an undefined (-u) function; see zshparam(1).
To create such a function, use the autoload builtin; see zshbuiltins(1).

> What's the trick? All the googling points to the same paragraph being
> quoted. The source contains a pretty good description of its uses but no
> hint as to startup.

There are some example startup files which ship with zsh; you'll need to
check your package to see if they were included.

The example zshrc includes:

-----------------------------< cut here >-------------------------------
# Where to look for autoloaded function definitions
fpath=($fpath ~/.zfunc)

# Autoload all shell functions from all directories in $fpath (following
# symlinks) that have the executable bit on (the executable bit is not
# necessary, but gives you an easy way to stop the autoloading of a
# particular shell function). $fpath should not be empty for this to
# work.
for func in $^fpath/*(N-.x:t); autoload $func
-----------------------------< cut here >-------------------------------

For comparison, dating back a while, I have:
 autoload ${^fpath}/*(N:t)
and mine is broken.  I thought that I had the executable check in;
obviously I lost it at some point in the past few years.  Oops!

Someone else might be able to explain why it's better to loop over the
expanded list, autoload'ing each, rather than "autoload glob".
-- 
"Reading my work email is a nice break from the nasty sunshine" - Carel


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

* Re: zmodload zmv ?
  2002-03-19 23:29 zmodload zmv ? Nick Croft
  2002-03-19 23:43 ` Bart Schaefer
  2002-03-19 23:46 ` Phil Pennock
@ 2002-03-19 23:47 ` Dennis Haney
  2002-03-20  0:02   ` Nick Croft
  2 siblings, 1 reply; 5+ messages in thread
From: Dennis Haney @ 2002-03-19 23:47 UTC (permalink / raw)
  To: Nick Croft, zsh-users

Nick Croft wrote:

>zmv looks to be a very handy utility. With Debian, it's located
>under /usr/share/zsh/4.0.4/functions/Misc  .
>
>I've tried starting it with zmodload zmv - nothing.
>
>I've moved, chowned, and chmodded it to a local fpath.
>
>What's the trick? All the googling points to the same paragraph being
>quoted. The source contains a pretty good description of its uses but no
>hint as to startup.
>
>It tries to do something if I explicitly quote the path in the command
>line. But emulating the example produced the following
>
>        nicko@work ~/tmp % ../.myfns/zmv '(*).bmp '$1.BMP'
>        ../.myfns/zmv: emulate: command not found
>        ../.myfns/zmv: local can only be used in a function
>        ../.myfns/zmv: typeset: unknown option: `-A'
>        ../.myfns/zmv: integer: command not found
>        ../.myfns/zmv: setopt: command not found
>
>I imagine those calls would work without problems if it could be loaded 
>with zmodload.
>
>Nick
>
I could recommend this line in your startup:
for func in $^fpath.zwc(N-.r:); autoload -U -w $func

then all functions are loaded at startup at little cost.

-- 
Dennis
use Inline C => qq{void p(char*g){printf("Just Another %s Hacker\n",g);}};p("Perl");




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

* Re: zmodload zmv ?
  2002-03-19 23:47 ` Dennis Haney
@ 2002-03-20  0:02   ` Nick Croft
  0 siblings, 0 replies; 5+ messages in thread
From: Nick Croft @ 2002-03-20  0:02 UTC (permalink / raw)
  To: Dennis Haney; +Cc: zsh-users

Dennis, Phil, Bart:

Thanks. I took the autoload option.

Nick


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

end of thread, other threads:[~2002-03-19 23:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-19 23:29 zmodload zmv ? Nick Croft
2002-03-19 23:43 ` Bart Schaefer
2002-03-19 23:46 ` Phil Pennock
2002-03-19 23:47 ` Dennis Haney
2002-03-20  0:02   ` Nick Croft

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