When editing inside a long org-mode block (#+BEGIN_.... - #+END_....) Emacs is really slow (it can take several seconds to write a single character), while editing the rest of the buffer takes normal time. I found this (org-mode 9 too slow with long code blocks) which is related to source blocks (whilst my problem is with "custom" blocks: #+BEGIN_exercise, #+BEGIN_solution, #+BEGIN_theorem,... which have no direct meaning in org) and found that also in this type of blocks the problem is the syntax highlighting:

M-x profiler-start   
Type a character in the code block
M-x profiler-report
- redisplay_internal (C function)                                                              1498  68%
 - jit-lock-function                                                                           1492  67%
  - jit-lock-fontify-now                                                                       1492  67%
   - jit-lock--run-functions                                                                   1492  67%
    - run-hook-wrapped                                                                         1492  67%
     + #<compiled 0x155edb4743f1>                                                              1492  67%

But inside these blocks I write common org syntax, so it's not needed to call jit-lock to highlight it: is there a way to enable it only for source blocks?

Maybe if exporting an heading as a block could be possible (Is it possible in org-mode to export a * heading to a \begin{heading} \end{heading} block construct?) it can be a solution.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.