Skip to content

Some message types are handled after other message types, regardless of input order. #755

@LyxHuston

Description

@LyxHuston

When passing messages to xplr from the command line through the -m flag, the order I pass in messages does not have any effect on execution order.

For a minimal example, try calling a custom function that changes some state based on the current vroot, then setting the vroot.

local past_vroot = nil

xplr.fn.log_vroot = function (app)
    past_vroot = app.vroot
end

... some sort of code that changes the dispplay based on `past_vroot`

note: It seems like lua functions that are called this way have their return messages ignored?

xplr -m "CallLua: log_vroot"
xplr -m "SetVroot: /arbitrary/path"

However, it will always set the vroot first, then call the lua function. The same happens if they are in reverse order.

I have also tried:

xplr -m "CallLua: log_vroot" -m "SetVroot: /arbitrary/path"
# error: xplr -m: too many positional values, not enough positional placeholders
xplr -m "CallLua: log_vroot"
xplr -m "Refresh"
xplr -m "SetVroot: /arbitrary/path"
# no difference
xplr -m "CallLua: log_vroot"
sleep 5
xplr -m "SetVroot: /arbitrary/path"
# no difference
xplr -m "[CallLua: log_vroot, SetVroot: /arbitrary/path]"
xplr -m "[{CallLua: log_vroot}, {SetVroot: /arbitrary/path}]"
xplr -m "{{CallLua: log_vroot}, {SetVroot: /arbitrary/path}}"
# all various parsing errors
xplr -m "0: [CallLua: log_vroot, SetVroot: /arbitrary/path]"
# expected error on using incorrect form

and a few other variations. It seems there is no reliable way to control input order of messages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions