]> git.eshelyaron.com Git - emacs.git/commit
(Ftranspose_regions): Fix text-properties for len1==len2
authorStefan Monnier <monnier@iro.umontreal.ca>
Sun, 23 Feb 2025 05:29:49 +0000 (00:29 -0500)
committerEshel Yaron <me@eshelyaron.com>
Wed, 26 Feb 2025 09:32:32 +0000 (10:32 +0100)
commiteeaa488bf8fe4f2e8eb887faa0d411e90972a970
tree2d0a41ea5613e33329160acf17449962b462297f
parent0ab85a17cf17c41919787444ad91f44ef822eeb2
(Ftranspose_regions): Fix text-properties for len1==len2

When `len1_byte == len2_byte`, the code presumed that len1==len2
as well in its handling of text-properties.  Fix that case.
While at it, try and reduce code duplication by hoisting common
code out of `if`s, and throw away the optimization for `len_mid == 0`
which only saved 3 trivial function calls.

* src/editfns.c (Ftranspose_regions): Shuffle the code a bit.

* test/src/editfns-tests.el (editfns-tests--transpose-equal-but-not):
New test.

(cherry picked from commit d84dbcb4504f6c53968a9f245b31676c90921b38)
src/editfns.c
test/src/editfns-tests.el