* [BUG] dead loop on (org-table-clean-line "|a|b|") [9.6 (release_9.6-3-ga4d38e @ share/emacs/29.0.60/lisp/org/)]
@ 2022-11-30 22:19 Lin Sun
2022-12-01 5:39 ` Ihor Radchenko
0 siblings, 1 reply; 6+ messages in thread
From: Lin Sun @ 2022-11-30 22:19 UTC (permalink / raw)
To: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 303 bytes --]
Hi,
The emacs builtin org-mode will stuck after try to expand the table with Tab on a table column.
After investigate, I found the function org-table-clean-line will run into dead loop for a simply call:
(org-table-clean-line "|a|b|")
Please help to fix this function. Thanks.
Best,
Lin
[-- Attachment #2: Type: text/html, Size: 2421 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [BUG] dead loop on (org-table-clean-line "|a|b|") [9.6 (release_9.6-3-ga4d38e @ share/emacs/29.0.60/lisp/org/)]
2022-11-30 22:19 [BUG] dead loop on (org-table-clean-line "|a|b|") [9.6 (release_9.6-3-ga4d38e @ share/emacs/29.0.60/lisp/org/)] Lin Sun
@ 2022-12-01 5:39 ` Ihor Radchenko
2022-12-02 7:37 ` Lin Sun
0 siblings, 1 reply; 6+ messages in thread
From: Ihor Radchenko @ 2022-12-01 5:39 UTC (permalink / raw)
To: Lin Sun; +Cc: emacs-orgmode@gnu.org
Lin Sun <sunlin7@hotmail.com> writes:
> The emacs builtin org-mode will stuck after try to expand the table with Tab on a table column.
> After investigate, I found the function org-table-clean-line will run into dead loop for a simply call:
>
> (org-table-clean-line "|a|b|")
>
> Please help to fix this function. Thanks.
I cannot reproduce.
Can you please provide detailed steps starting from emacs -Q?
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [BUG] dead loop on (org-table-clean-line "|a|b|") [9.6 (release_9.6-3-ga4d38e @ share/emacs/29.0.60/lisp/org/)]
2022-12-02 7:37 ` Lin Sun
@ 2022-12-02 6:40 ` Ihor Radchenko
2022-12-02 22:18 ` Lin Sun
2022-12-02 7:40 ` Lin Sun
1 sibling, 1 reply; 6+ messages in thread
From: Ihor Radchenko @ 2022-12-02 6:40 UTC (permalink / raw)
To: Lin Sun; +Cc: emacs-orgmode@gnu.org
Lin Sun <sunlin7@hotmail.com> writes:
>> 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.
`org-string-width' does not touch match data.
Considering that you can only reproduce with Spacemacs, it might be
spacemacs screwing the match data. Not Org.
There is no reason to fix something not caused by Org on Org side.
I suggest you to contact Spacemacs devs.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [BUG] dead loop on (org-table-clean-line "|a|b|") [9.6 (release_9.6-3-ga4d38e @ share/emacs/29.0.60/lisp/org/)]
2022-12-01 5:39 ` Ihor Radchenko
@ 2022-12-02 7:37 ` Lin Sun
2022-12-02 6:40 ` Ihor Radchenko
2022-12-02 7:40 ` Lin Sun
0 siblings, 2 replies; 6+ messages in thread
From: Lin Sun @ 2022-12-02 7:37 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode@gnu.org
[-- Attachment #1.1: Type: text/plain, Size: 444 bytes --]
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
[-- Attachment #1.2: Type: text/html, Size: 1999 bytes --]
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-table.el-fix-match-data-changed-in-org-table-cle.patch --]
[-- Type: text/x-patch; name="0001-org-table.el-fix-match-data-changed-in-org-table-cle.patch", Size: 909 bytes --]
From 428f989c6e9f846cf6a1bbb25ada56146789a2c6 Mon Sep 17 00:00:00 2001
From: Lin Sun <lin.sun@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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [BUG] dead loop on (org-table-clean-line "|a|b|") [9.6 (release_9.6-3-ga4d38e @ share/emacs/29.0.60/lisp/org/)]
2022-12-02 7:37 ` Lin Sun
2022-12-02 6:40 ` Ihor Radchenko
@ 2022-12-02 7:40 ` Lin Sun
1 sibling, 0 replies; 6+ messages in thread
From: Lin Sun @ 2022-12-02 7:40 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 181 bytes --]
Hi Ihor,
> I cannot reproduce.
> Can you please provide detailed steps starting from emacs -Q?
It's not happened with emacs -Q, but happened with Spacemace configuration.
[-- Attachment #2: Type: text/html, Size: 1256 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [BUG] dead loop on (org-table-clean-line "|a|b|") [9.6 (release_9.6-3-ga4d38e @ share/emacs/29.0.60/lisp/org/)]
2022-12-02 6:40 ` Ihor Radchenko
@ 2022-12-02 22:18 ` Lin Sun
0 siblings, 0 replies; 6+ messages in thread
From: Lin Sun @ 2022-12-02 22:18 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 549 bytes --]
Hi Ihor,
> Considering that you can only reproduce with Spacemacs, it might be
> spacemacs screwing the match data. Not Org.
> There is no reason to fix something not caused by Org on Org side.
Agree with you, I had located the dead loop is cause by the advice function for set-window-buffer from evil package, in which the function will screw the match data.
I had posted a patch to the evil-package to fix this issue.
https://github.com/emacs-evil/evil/pull/1724/files
Please mark this ticket as closed if you wish. Thank you
Lin
[-- Attachment #2: Type: text/html, Size: 1988 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-12-02 22:29 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-30 22:19 [BUG] dead loop on (org-table-clean-line "|a|b|") [9.6 (release_9.6-3-ga4d38e @ share/emacs/29.0.60/lisp/org/)] Lin Sun
2022-12-01 5:39 ` Ihor Radchenko
2022-12-02 7:37 ` Lin Sun
2022-12-02 6:40 ` Ihor Radchenko
2022-12-02 22:18 ` Lin Sun
2022-12-02 7:40 ` Lin Sun
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.