local old = SILE.Commands.x
SILE.registerCommand("x", ...)
process(...)
SILE.Commands.x = old
This pattern is something we use a lot internally and that gets used a lot externally. It is neither ergonomic nor any other good words.
We provide a SILE.settings:temporarily() to wrap settings and then reset to where we started. We can and should provide a similar wrapper for commands.
Then the only question would be whether to use this by default for anything loaded/defined during document processing or not. That might take some experimentation.
This pattern is something we use a lot internally and that gets used a lot externally. It is neither ergonomic nor any other good words.
We provide a
SILE.settings:temporarily()
to wrap settings and then reset to where we started. We can and should provide a similar wrapper for commands.Then the only question would be whether to use this by default for anything loaded/defined during document processing or not. That might take some experimentation.