Closed xiaobing-huang closed 1 year ago
Can you please share your config and the commit hash of spacehammer:
cd ~/.hammerspoon
git rev-parse @
Get that error too but doesn't seem to be preventing any functionality:
2021-10-26 22:09:06: 22:09:06 ERROR: LuaSkin: hs.application.watcher callback: ...on.app/Contents/Resources/extensions/hs/fnutils/init.lua:265: bad argument #1 to 'for iterator' (table expected, got nil)
stack traceback:
[C]: in function 'next'
...on.app/Contents/Resources/extensions/hs/fnutils/init.lua:265: in function 'hs.fnutils.find'
(...tail calls...)
./lib/apps.fnl:65: in local 'tx_fn'
./lib/statemachine.fnl:29: in function 'lib.statemachine.send'
Can you please share your config and the commit hash of spacehammer:
cd ~/.hammerspoon git rev-parse @
and commit hash is: 85d6f263b50ea7079aecceaf9caa3232c0dbad76
Looks like a bug in modal's active->submenu
, specifically the state's :menu
should be a table, but we set it to :nil
sometimes, so prev-menu.items
is nil in this line
(fn active->submenu
[state action menu-key]
"
Enter a submenu like entering into the Window menu from the default main menu.
Takes the current menu state table and the submenu key as 'extra'.
Returns updated menu state
"
(let [{:config config
:menu prev-menu} state.context
menu (if menu-key
(find (by-key menu-key) prev-menu.items) ; prev-menu is probably :nil so .items is nil
config)]
{:state {:current-state :submenu
:context (merge state.context {:menu menu})}
:effect :open-submenu}))
I think that this'll fix it.
diff --git a/lib/modal.fnl b/lib/modal.fnl
index e97c2fc..625144d 100644
--- a/lib/modal.fnl
+++ b/lib/modal.fnl
@@ -317,7 +317,7 @@ switching menus in one place which is then powered by config.fnl.
Returns updated modal state machine state table.
"
{:state {:current-state :idle
- :context (merge state.context {:menu :nil
+ :context (merge state.context {:menu state.context.config
:history []})}
:effect :close-modal-menu})
@@ -488,7 +488,7 @@ switching menus in one place which is then powered by config.fnl.
"
(let [initial-context {:config config
:history []
- :menu :nil}
+ :menu config}
template {:state {:current-state :idle
:context initial-context}
:states states
Could someone please test it?
Just applied it, will follow up if I see issues in the log
Did you happen to see anything?
Did you happen to see anything?
sorry for late feedback, the error still occurs.
2021-11-06 07:53:17: 07:53:17 ERROR: LuaSkin: hs.application.watcher callback: ...on.app/Contents/Resources/extensions/hs/fnutils/init.lua:265: bad argument #1 to 'for iterator' (table expected, got nil) stack traceback: [C]: in function 'next' ...on.app/Contents/Resources/extensions/hs/fnutils/init.lua:265: in function 'hs.fnutils.find' (...tail calls...) ./lib/apps.fnl:65: in local 'tx_fn' ./lib/statemachine.fnl:29: in function 'lib.statemachine.send' (...tail calls...) 2021-11-06 07:53:44: 07:53:44 apps.fnl: app is now: nil 2021-11-06 07:53:44: app is now: nil 2021-11-06 07:53:44: 07:53:44 ERROR: LuaSkin: hs.application.watcher callback: ./lib/apps.fnl:154: table index is nil stack traceback: ./lib/apps.fnl:154: in local 'sub' ./lib/statemachine.fnl:44: in function 'lib.statemachine.send' (...tail calls...)
just pulled the latest changes, will see whether the same error still occur.
I have not merged this fix. You would have to manually apply the change I mention above to test the fix.
applied the changes, will let you know whether it works.
Any luck?
Any luck?
this error seems caused by line 189 in apps.fnl
the variable apps is nil, if i change apps to state.context.apps, the error will be gone.
I pushed a PR to fix the second error, but note that it's not the same as your original error.
@eccentric-j did my fix above fix the error you were having? Note that that error is not the same as the one fixed in #153, which is here:
2021-11-06 07:53:44: 07:53:44 ERROR: LuaSkin: hs.application.watcher callback: ./lib/apps.fnl:154: table index is nil
stack traceback:
./lib/apps.fnl:154: in local 'sub'
./lib/statemachine.fnl:44: in function 'lib.statemachine.send'
(...tail calls...)
Just pulled, will let you know
Haven't seen this since so I think it's fixed
After start my computer, activate modal, got below error:
the main modal won't appear, then open hammerspoon console, main modal appears.