1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Ensure that we don't call print-unreadable-function from " prin1"

* src/print.c (PRINTPREPARE): Bind the current buffer so that we
can retrieve it later.
(print_vectorlike): Use it (bug#56773).
(syms_of_print): New internal `print--unreadable-callback-buffer'
variable.
This commit is contained in:
Lars Ingebrigtsen 2022-07-28 12:23:53 +02:00
parent 22a5f02234
commit 4895ca16f7
3 changed files with 29 additions and 1 deletions

View file

@ -1122,5 +1122,15 @@ final or penultimate step during initialization."))
(should (equal (butlast l n)
(subr-tests--butlast-ref l n))))))
(ert-deftest test-print-unreadable-function-buffer ()
(with-temp-buffer
(let ((current (current-buffer))
callback-buffer)
(let ((print-unreadable-function
(lambda (_object _escape)
(setq callback-buffer (current-buffer)))))
(prin1-to-string (make-marker)))
(should (eq current callback-buffer)))))
(provide 'subr-tests)
;;; subr-tests.el ends here