Improved code for revert-matching-buffers and vastly improved code for st-query.