[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

Re: "wmk -a" and auto-adjusted variables?

On Fri, Jul 09, 1999 at 09:52:09AM +0200, Denis Barbier wrote:
> On Thu, 8 Jul 1999 plonka@doit.wisc.edu wrote:
> [...]
> > In this instance however, it's less desirable than being able to use just
> > command-line switches.  Since I'm invoking wmk from another Makefile, I'd
> > like that Makefile to be self-contained (i.e. not to be reliant on the
> > content of the ".wmlrc").
> Write a rule like
> .wmlrc:
> 	echo '-DIMG~images' >$@

Great^H^H^H^H^HCreative minds think alike. ;^)

> > It's surprising that putting "-DIMG~images" on the wmk command line is
> > different than putting it in the ".wmlrc" file.  No?
> No!
> As i said before, -D is not an option of wmk, but wml. It makes all the
> difference.

I do understand that "-D" is a wml option.

To rephrase the inconsistency that I see: using "-D~value" on the wmk
command-line (to have it propogated down to wml) does not always have
the same effect as passing "-D~value" on the wml command-line.

This is because, even though (as you were quick to point out) "-D" is only
a wml switch, wmk changes its current working directory before invoking
wml, and therefore (as a side-effect) changes the resulting value of
auto-adjusted variables.

> > I'm thinking that perhaps:
> > 1) wmk should not chdir around as it invokes wml, or should have a new
> >    mode that causes it not to chdir.
> Certainly not.


> > - or -
> > 2) The wmk man page should document the issue that "-D~value" on the
> >    wmk command-line won't have the same effect as passing it to wml
> >    directly (if wml had been invoked from the same dir) or specifying
> >    it in an rc file.
> Reread the wmk manpage, it does not document the -D option. So i believe
> such a warning would be obfuscated.

The wmk man-page does say:

     All WML-options directly correspond to their counterparts in
     wml(1) because they are just forwarded by wmk except the -n
     and -o options which are implicitly created by wmk for each
     wml invocation.

I took "directly correspond to" to mean "have the same effect as".
Just because the WML-options "are just forwarded [to wml] by wmk",
doesn't mean they will have the same effect - specifically since the
auto-adjusted variables are externally influenced by wml's current
working directory, which is sometimes changed before wml is invoked by
wmk (unbeknownst to the wmk user).

As I said, personally, I liked the idea of adding a wmk switch that causes
it to remain in the same directory in which it was invoked because that's
the easiest way I can think of to get the "wmk -DNAME~PATH sub-dir" to work
as desired.  However, since you don't care for that, perhaps the wmk
man-page could read:


   Auto-adjusted variables specfied as "-DNAME~PATH" on the wmk command-
   line will not necessarily have the same effect as a similar definition
   in a "./.wmlrc" file.  This is because, when processing sub-directories,
   wmk changes its working directory to each of those directories, which
   can influence the interpolation of such auto-adjusted variables.
   When specified on the command line, such variables are interpolated
   with respect to wml's current working directory at the time of its
   invocation.  So, if you wish such variables to be interpolated relative
   to wmk's current working directory at the time of its invocation, one
   can work-around this issue by specifying "-DNAME~PATH" in a ".wmlrc"
   in that directory rather than specifying it on the wmk command-line.

Without such a warning, the only way I could find an explanation of the
behavior I observed was to read the wmk source (and see the chdir(2) calls).

Anyway, thanks for your thoughts Denis...

I don't need to pursue this thread any longer since I don't think that
we're mis-understanding each other.


plonka@doit.wisc.edu  http://net.doit.wisc.edu/~plonka  ARS:N9HZF  Madison, WI
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com