vfclists · 2022-07-16 22:20
I am doing some processing of some org documents and after loading the file into non interactive buffers I set org-mode before doing the processing.
The code runs along this line
(with-temp-buffer
(insert-file-contents-literally full-filename)
(org-mode)
...
I suspect that running `org-mode` after I open the file is the reason why it is slow.
Can the same processing be done so long as the files is not interactively edited? The task involved is a read-only task?
dpoggio · 2022-07-16 22:41
Have you tried just not running `(org-mode)`. I mean, it would’ve been easier.
vfclists · 2022-07-16 22:47
I run `(org-mode)` because I assume that some of the org functions may not
run properly if the file is not in `org-mode`
Alan_Shutko · 2022-07-16 23:30
Try it and see if it works. Probably the org functions do require something, though.
akirakom · 2022-07-17 03:00
`(delay-mode-hooks (org-mode))` is faster and probably still serves your purpose.
yantar92 · 2022-07-17 11:32
For faster startup I suggest, `(let ((org-inhibit-startup t)) (org-mode))`. It is how org-mode does batch processing internally. If things are still slow with the suggested approach, can you profile the performance and share results?