Hi,

i am trying to improve goto_or_run

        ,----[  ]
        | function goto_or_run(mplex, title, command)
        |     local cwins=lookup_complete_clientwin(title)
        |     local ncwins=table.getn(cwins)
        |     if ncwins>0 then
        |         local acti=ncwins
        |         for i, cwin in ipairs(cwins) do
        |             -- Unfortunately there's no is_active function. It is to be
        |             -- added. For now the test mplex:current()==cwin should do it 
        |             -- supposing we're working with a simple setup with no full 
        |             -- screen client windows and nested frames and mplex is
        |             -- itself active.
        |             if mplex:current()==cwin then
        |             --if cwin:is_active() then
        |                 acti=i
        |                 break
        |             end
        |         end
        |         cwins[math.mod(acti, ncwins)+1]:goto()
        |     else
1       |         co=coroutine.create(function(mplex,command) exec_in(mplex, command) 
end)
2       |         coroutine.resume(co)
3       |         while coroutine.status(co)=="running" do
4       |         end
        |         local cwins=lookup_complete_clientwin(title)
        |         local ncwins=table.getn(cwins)
        |         if ncwins>0 then
        |                 local acti=ncwins
        |                 for i, cwin in ipairs(cwins) do
        |                     if mplex:current()==cwin then
        |                         acti=i
        |                         break
        |                     end 
        |                 end 
        |                 cwins[math.mod(acti, ncwins)+1]:goto()
        |         end     
        |     end 
        | end 
        `----

it should change to the frame containing the application even if we 
start the application (it could be in a other frame because of 
kludges.lua).

There are several problems. First i tried to put after the original
"exec_in(mplex, command)" a "goto_or_run(mplex, title, command)", but
this killed my ion (exec_in seems to execute asynchronously). Then i tried
"co=coroutine.create(exec_in(mplex, command))" but it complained that
exec_in is no lua-routine (IMHO this should work, exec_in is a lua
function). So i put it in a anonymous function but now it doesn't work
at all. Whats wrong?

TIA,
Johannes
-- 
The NSA isn't interested in the security of others, so much as it is
their *insecurity*. Using security tools written by them is like
hiring babysitters from Nambla[1]. <snip> [1] North American Man-Boy
Love Assocation. Not a good source for babysitters. [Daniel Swan]

Reply via email to