The function
locally-disable-sql-reader-syntax
turns off square bracket syntax and does not change syntax state. This ensures that restore-sql-reader-syntax-state restores the current enable/disable state.
The intended use of
locally-disable-sql-reader-syntax
is in a file:
#.(locally-disable-sql-reader-syntax)
disable-sql-reader-syntax
enable-sql-reader-syntax
locally-enable-sql-reader-syntax
restore-sql-reader-syntax-state