Hi Arash, Thanks, what you pointed out can indeed be an issue (although not for the specific way that I use the command in practice...). I've attached the updated patch. (I'm also inclined to add further tests, but maybe next week; could do that in a separate patch?)
Paul
>From dcb4938d6451f162593da71320142b7ce33c44ca Mon Sep 17 00:00:00 2001 From: Paul Nelson <[email protected]> Date: Mon, 29 Sep 2025 11:01:39 +0100 Subject: [PATCH] ; Fix recent change * latex.el (LaTeX--modify-math-1): Only insert additional space after punctuation when there is already a space present (and only one space). --- latex.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/latex.el b/latex.el index d7b2ef23..6760ccaf 100644 --- a/latex.el +++ b/latex.el @@ -9652,7 +9652,8 @@ marker that keeps track of cursor position." (looking-at-p "[.?!]") (save-excursion (forward-char) - (insert " "))) + (when (looking-at-p " [^ ]") + (insert " ")))) (end-of-line 2) (indent-region start (point)))))) -- 2.39.5 (Apple Git-154)
