(defun test-check-syntax-table (begin end) (unless (eq (syntax-table) test-syntax-prop-mode-syntax-table) (error "syntax table is changed to %s during syntax propertize" (if (eq (syntax-table) (standard-syntax-table)) 'standard-syntax-table 'other-syntax-table)))) (define-derived-mode test-syntax-prop-mode prog-mode "TestSyntaxProp" "A mode for testing syntax-propertize bug(?)." (setq-local syntax-propertize-function #'test-check-syntax-table) (setq-local font-lock-defaults '(nil nil nil nil nil (font-lock-syntactic-face-function . ignore) (parse-sexp-lookup-properties . t)))) (switch-to-buffer "tt") (test-syntax-prop-mode) (erase-buffer) (insert "foo") (with-syntax-table (standard-syntax-table) (scan-sexps 1 1))