FVWM: is this is a bug?

2010-06-20 Thread Michael Treibton
hi

i have this -

SetEnv numofterms 10
key q R A Echo $[numofterms]

which works. but when i change "numofterms" to be a different number,
my key binding still shows "10".

why? is it a bug?

Thanks!

M. Treibton



Re: FVWM: is this is a bug?

2010-06-20 Thread Thomas Adam
On Sun, Jun 20, 2010 at 07:21:47PM +0100, Michael Treibton wrote:
> hi
> 
> i have this -
> 
> SetEnv numofterms 10
> key q R A Echo $[numofterms]
> 
> which works. but when i change "numofterms" to be a different number,
> my key binding still shows "10".
> 
> why? is it a bug?

Ah.  You've been hit by the "expansion problem".  It's not a bug, it's just
that we're exposing FVWM's internals to the user again.  :)

When FVWM encounters a line such as:

Key q R A Echo $[numofterms]

It will expand that, to be (in your case):

Echo 10

So the full line might look like this (although note that this isn't how
FVWM stores it or anything, I am just doing this for ease of explanation):

Key q R A Echo 10

Which means now, that $[numofterms] has been interpolated out fully -- and
won't ever be interpolated again.

What you need to "fix" your problem is this:

Key q R A Echo $$[numofterms]

And, as in the above, you need to read the thing backwards, just like FVWM
is doing when it parses the line.  So first time around (when it encounters
the keyword "Key") FVWM will expand it out like this:

Key q R A Echo $[numofterms]

Then, when the action for the "q" binding is encountered, FVWM still sees to
run:

Echo $[numofterms]

... thus honouring the expansion of $[numofterms] for no matter how many
times you might change this environment variable.

Is that clear?  The trick is to read these things backwards -- and you need
two "$"s -- one for the Echo command, the other for the Key command.

If you, or anyone else, feels this information needs adding to the man page
or making clearer, *please* send me a patch.  It would save me a lot of
time.  :)

Kindly,

-- Thomas Adam

-- 
"Deep in my heart I wish I was wrong.  But deep in my heart I know I am
not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.)



Re: FVWM: is this is a bug?

2010-07-12 Thread Michael Treibton
On 20 June 2010 19:28, Thomas Adam  wrote:
> Key q R A Echo $$[numofterms]
>
> And, as in the above, you need to read the thing backwards, just like FVWM
> is doing when it parses the line.  So first time around (when it encounters
> the keyword "Key") FVWM will expand it out like this:
>
> Key q R A Echo $[numofterms]
>
> Then, when the action for the "q" binding is encountered, FVWM still sees to
> run:
>
> Echo $[numofterms]
>
> ... thus honouring the expansion of $[numofterms] for no matter how many
> times you might change this environment variable.
>
> Is that clear?  The trick is to read these things backwards -- and you need
> two "$"s -- one for the Echo command, the other for the Key command.
>
> If you, or anyone else, feels this information needs adding to the man page
> or making clearer, *please* send me a patch.  It would save me a lot of
> time.  :)

wowza! thanks.  how do i go about adding this information to the man
page? i dont know anything about how i would do this.

where did you learn about this information?

also, is there not a wiki? can this information not go there as well?

is the wiki officially part of fvwm? wouldnt it be easier to replace
the website with it?

M. Treibton



Re: FVWM: is this is a bug?

2010-07-12 Thread Thomas Adam
On Mon, Jul 12, 2010 at 03:24:41PM +0100, Michael Treibton wrote:
> On 20 June 2010 19:28, Thomas Adam  wrote:
> > Key q R A Echo $$[numofterms]
> >
> > And, as in the above, you need to read the thing backwards, just like FVWM
> > is doing when it parses the line. ?So first time around (when it encounters
> > the keyword "Key") FVWM will expand it out like this:
> >
> > Key q R A Echo $[numofterms]
> >
> > Then, when the action for the "q" binding is encountered, FVWM still sees to
> > run:
> >
> > Echo $[numofterms]
> >
> > ... thus honouring the expansion of $[numofterms] for no matter how many
> > times you might change this environment variable.
> >
> > Is that clear? ?The trick is to read these things backwards -- and you need
> > two "$"s -- one for the Echo command, the other for the Key command.
> >
> > If you, or anyone else, feels this information needs adding to the man page
> > or making clearer, *please* send me a patch. ?It would save me a lot of
> > time. ?:)
> 
> wowza! thanks.  how do i go about adding this information to the man
> page? i dont know anything about how i would do this.

It's a complete and utter pain the arse, due to the messy XML.  First step
is to checkout the FVWM CVS sources [1].  From there, you can look in the
doc/ directory, and then do what I do, and just grep for the right file.

When you've edited the file(s) in question, make sure you compile FVWM from
the top-level directory -- ensuring you --enable-htmldoc, so that you can
see not only the manpage generation, but the resultant HTML pages.  When you
don't get the results you expected, spend an hour trawling through the
documentation for docbook and try again.  When, after half-an-hour it's
still not working for you, give me a shout, and I might just do it for you.
:)

Yes, it will suck, I am sorry to say.   But don't let that put you off
trying, you might get lucky and hit upon avoiding the nuainces; perhaps
beginners luck.  :)

Should you get past that, see docs/DEVELOPER-CVS, or the same CVS
information [1] you read before about how to submit patches.

> where did you learn about this information?

Mis-spent youth.

> also, is there not a wiki? can this information not go there as well?

It could -- go see "fvwm.org" for the link, or if you prefer [2].

> is the wiki officially part of fvwm? wouldnt it be easier to replace
> the website with it?

That's a complete non-sequitur to your question.

-- Thomas Adam

[1] http://fvwm.org/documentation/dev_cvs.php
[2] http://fvwmwiki.xteddy.org

-- 
"It was the cruelest game I've ever played and it's played inside my head."
-- "Hush The Warmth", Gorky's Zygotic Mynci.