Thanks for implementing that. While checking the surrounding code I noticed that upcase-initials-region could use the same improvement; also, there were some longstanding potential infloops and crashes in the noncontiguous region code. So I installed the attached further patch.