0

I am trying to create a table in org-mode like that (/ is where my cursor is)

| this is a test | foo | bar |
| ---------/---- | --- | --- |

If I now press enter, emacs hangs and I have to interrupt via C-g.

After debugging a while, I figured out that replace-match was not replacing the latest match, but seemingly random parts of the string when evil-mode was active. This causes an endless loop in org-table-clean-line and as a result, emacs freezes when I try to add a new row.

So my question is: what is causing the different behaviour of replace-match and how can I fix it so that I can use evil-mode without my tables freezing in org-mode?

I am using GNU Emacs 28.1 (build 1, x86_64-apple-darwin20.6.0, Carbon Version 164 AppKit 2022.6) of 2022-05-03

4
  • 1
    Instead of profiling, you should turn on debug-on-quit and then reproduce the problem. When you are sure it is hung, press C-g. You should get a backtrace with the function that is causing the problem at the top. You might want to do it a few times, to make sure that it is the same function every time.
    – NickD
    Jul 25 at 22:19
  • 1
    What's the question?
    – Drew
    Jul 25 at 22:28
  • @Drew that's a fair question. I was frustrated and had no idea (or maybe energy) left how to tackle this. I had to write it down and ask someone for direction. NickD's comment is a step into the right direction. I might close this question as "unclear" and pose a new one, as soon as I can pinpoint the error more specifically. What do you think?
    – Christoph
    Jul 26 at 5:16
  • 1
    I think you should be able to rephrase the title and perhaps the content to pose a question. You do have at least one question, don't you?
    – Drew
    Jul 26 at 15:30

1 Answer 1

0

I can not answer the part regarding replace-match, but I found the underlying issue.

In my config I use use-package and straight.el to configure my packages. I had something along the following lines written there:

(use-package org
    :straight t
    :config
    [...]
)

Since org is built in, there's no need to pull it from straight. I could fix my problem by changing the configuration like that:

(use-package org
    :straight (:type built-in)
    :config
    [...]
)

Pulling org from straight fetches the latest version 9.5.4, whereas the built-in version is 9.5.2. Apparently some changes in 9.5.3 or 9.5.4 trigger the endless loop.

Digging a little deeper, this is a sample configuration that reproduces the problem:

;; ------ bootstrapping straight -------------

(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
    (url-retrieve-synchronously
     "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
     'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(straight-use-package 'use-package)

;; -------- bootstrapping ends here ------------

(use-package evil
  :straight t
  :config (evil-mode))

(use-package evil-leader
  :straight t
  :config (global-evil-leader-mode))

(use-package org
  :straight t)

I could narrow it down to evil, evil-leader and org v9.5.4. If you start emacs with this configuration, create or open an org file and try to add a new row in a table, your emacs should freeze.

3
  • IIUC, you are saying that the problem arises when you use the latest version of Org mode, but it goes away if you use the built-in version. Can you specify exactly which version produces the error and which version you are now using? This might be a bug in latest Org mode: knowing which version works and which version does not should allow somebody to try to reproduce it and, if it is a bug, it should help narrow down the change that introduced it.
    – NickD
    Jul 27 at 2:37
  • @NickD I added a couple more details. Should this be reported as a bug? I feel like I lack the skills to debug any further here.
    – Christoph
    Jul 27 at 8:47
  • I think you have enough details in your answer to open a bug report. It might be on the evil side, but it is more likely to be on the Org mode side I think. Just do M-x org-submit-bug-report, paste your question and your answer (and include a link to this question too) and send it in.
    – NickD
    Jul 27 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.