]> git.eshelyaron.com Git - emacs.git/commit
whitespace: Avoid mutating original buffer's markers in clones
authorRichard Hansen <rhansen@rhansen.org>
Tue, 13 Dec 2022 06:33:43 +0000 (01:33 -0500)
committerEli Zaretskii <eliz@gnu.org>
Wed, 21 Dec 2022 14:02:30 +0000 (16:02 +0200)
commitd76d7a3bebf1ff0b06a38f7f96d316752844ed10
treea58b2418407d023fdad97f7c14e806f5b1416bdb
parent12b2b8864c295ce27594e8a907ebb3423e58a9d4
whitespace: Avoid mutating original buffer's markers in clones

* lisp/whitespace.el (whitespace--clone): New hook function that is
run after cloning a buffer that copies `whitespace-bob-marker' and
`whitespace-eob-marker' and changes the copies to point to the new
buffer (Bug#59618).
(whitespace-color-on): Register the hook function.
(whitespace-color-off): Unregister the hook function.

* test/lisp/whitespace-tests.el
(whitespace-tests--with-test-buffer): New macro.
(whitespace-tests--check-markers): New function.
(whitespace-tests--indirect-clone-breaks-base-markers)
(whitespace-tests--indirect-clone-markers)
(whitespace-tests--regular-clone-markers): New tests.
lisp/whitespace.el
test/lisp/whitespace-tests.el