Hi Ihor, > I cannot reproduce. > Can you please provide detailed steps starting from emacs -Q?
The bug caused by the function org-table-clean-line calls the org-string-width inside a string-match clause without protection, for the org-string-width maybe change the match data then cause the string-match run into wrong result. The attachment is a quick patch for the issue, please help to review and apply it, thanks
From 428f989c6e9f846cf6a1bbb25ada56146789a2c6 Mon Sep 17 00:00:00 2001 From: Lin Sun <lin....@zoom.us> Date: Fri, 2 Dec 2022 07:31:05 +0000 Subject: [PATCH] org-table.el: fix match-data changed in org-table-clean-line --- lisp/org-table.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org-table.el b/lisp/org-table.el index b160dc97c..6e6835fba 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -1699,7 +1699,7 @@ In particular, this does handle wide and invisible characters." (setq s (mapconcat (lambda (x) (if (member x '(?| ?+)) "|" " ")) s "")) (while (string-match "|\\([ \t]*?[^ \t\r\n|][^\r\n|]*\\)|" s) (setq s (replace-match - (concat "|" (make-string (org-string-width (match-string 1 s)) + (concat "|" (make-string (save-match-data (org-string-width (match-string 1 s))) ?\ ) "|") t t s))) s)) -- 2.20.5