We need to put the results and suggestions of this discusstion in
a file.

> On Thu, Nov 18, 2021 at 12:31:09AM +0100, Dominik Vogt wrote:
> > Anyway, we need
> > infrastructure for automated testing.
>
> We used to have something like that but it fell into bitrot and I removed it
> years ago.

Yep.

> That being said, it's probably more valuable to have a set of
> tests which capture the behaviour of the parser, than it is about checking
> window positions, etc.

Most of the tests were meant to catch parsing bugs, leaks and
crashes.  A mor organised approach in the future would be good.
Maybe it would even be possible to generate test cases for
commands programmatically from the BNF.

> I see some of this as recognising that the commands need to have a common
> syntax.  Just dreaming up something here, but take the Move command for
> example:
>
>    Move   <-- context is known or asked for, but interactive nonetheless
>    Move -s fvwm.next.XTerm  <-- next XTerm in the ring (but interactive)
>    Move -s fvwm.prev.XTerm -p 200p 100p <-- prev XTerm, non-interactive
>
> (Here, -s indicates the *source* window).
>
> Resize could also work the same with with -s
>...
> Commands might collectively take '-s' to indicate a source, or '-t' to
> indicate the destination.  Be it a specific geometry, pixel/percentage,
> desktop, page, etc.  The syntax for these can be unified and abstracted away.
>...

Sounds interesting.  While implementing new ways of selecting
source/target (what is the difference?) it is still possible to
keep the existing conditionals working:  If "-s ..." is present,
use it.  Otherwise use the window that has been selected  by a
conditional.  If that's not defined either, ask the user to select
one.

For multi-target conditions the syntax would work too.

Old way, loop over all windows, filter them by a resource name,
then apply a command to them:

  All (xterm) Close

Same in new syntax (assuming "-c" marks the beginning of the
command to execute):

  All --match-resource "xterm" -c Close

Hypothetical filtering by the command itself.  Call the command
for each window in turn, but the command does nothing unless the
--match-resource condition is true.

  All -c Close --match-resource "xterm"

Command that works only on matching windows:

  Close --match-resource "xterm"

etc.  "All" would then work like a prefix (a la "silent", "keeprc"
etc.).

--

Taking it a step further filters can be applied to *any* command
line, not just commands:

  foobarfunc --match-resource "xterm"

(Problem: How can we distinguish between general filters and the
actual command/function arguments?)

Note:  Complex functions already have a kind of filtering with the
"I", "C", ... bits.

Ciao

Dominik ^_^  ^_^

--

Dominik Vogt

Reply via email to