Matt Lundin <m...@imapmail.org> writes: > Commit e3b79ad2bf7ab7b91c0ad2b8383d639bfe154ce7 from Feb. 9, 2020 (Allow > a new value for `org-adapt-indentation') introduced a bug that causes > logbooks to be incorrectly indented when promoting an entry. As a > result, there are also significant slowdowns when promoting and demoting > an entry with hundreds of logbook entries.
I did some more investigation and think the bug may lie deeper. The commit above changed the functions used in org-fixup-indentation. Prior to the commit org-fixup-indentation called org-indent-line on each line within a LOGBOOK. Now it calls org-indent-region on the entire LOGBOOK. So the problems seem to lie in org-indent-region. To test this, I manually called org-indent-region on a region containing a LOGBOOK. I saw the same indentation problems and slowness as I reported in the previous email. Here are the profiling results from calling org-indent-region on a LOGBOOK containing 303 lines (mix of notes, clock drawers, state changes): org-indent-region 303 20.374798015 0.0672435578 org-element-at-point 655 6.7059473859 0.0102380876 org-element--parse-to 654 6.6907969839 0.0102305764 org-element--current-element 36791 6.3040008640 0.0001713462 org-element--list-struct 3372 3.6317395729 0.0010770283 org--get-expected-indentation 355 3.00431385 0.0084628559 org-element-clock-parser 2738 0.7868292469 0.0002873737 org-element-item-parser 29700 0.7527248339 2.534...e-05 org-element-timestamp-parser 2738 0.7245477349 0.0002646266 org-parse-time-string 5476 0.6267072680 0.0001144461 org-element--collect-affiliated-keywords 4026 0.2572965799 6.390...e-05 org-element-drawer-parser 654 0.1057650070 0.0001617201 org-element-plain-list-parser 3372 0.0736009140 2.182...e-05 org-get-limited-outline-regexp 9063 0.0575772250 6.352...e-06 org-at-heading-p 8083 0.0267149439 3.305...e-06 org-element--cache-put 36791 0.0176797030 4.805...e-07 org-element-paragraph-parser 327 0.011128276 3.403...e-05