0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-08-25 08:32:53 +00:00

org-mode: Fix element cache updates when aligning tables during startup

* lisp/org.el (org-mode): Do not suppress modification hooks when
aligning tables.  Otherwise, cache state may become invalid.

Reported-by: Stefan <org@stefan.failing.systems>
Link: https://orgmode.org/list/87tu1wse45.fsf@localhost
This commit is contained in:
Ihor Radchenko 2023-01-02 10:24:34 +03:00
parent 563a4396b6
commit 1cd39c9e30
No known key found for this signature in database
GPG key ID: 6470762A7DA11D8B

View file

@ -4898,16 +4898,20 @@ The following commands are available:
(= (point-min) (point-max)))
(insert "# -*- mode: org -*-\n\n"))
(unless org-inhibit-startup
(when (or org-startup-align-all-tables org-startup-shrink-all-tables)
(org-table-map-tables
(cond ((and org-startup-align-all-tables
org-startup-shrink-all-tables)
(lambda () (org-table-align) (org-table-shrink)))
(org-startup-align-all-tables #'org-table-align)
(t #'org-table-shrink))
t))
;; Suppress modification hooks to speed up the startup.
;; However, do it only when text properties/overlays, but not
;; buffer text are actually modified. We still need to track text
;; modifications to make cache updates work reliably.
(org-unmodified
(when org-startup-with-beamer-mode (org-beamer-mode))
(when (or org-startup-align-all-tables org-startup-shrink-all-tables)
(org-table-map-tables
(cond ((and org-startup-align-all-tables
org-startup-shrink-all-tables)
(lambda () (org-table-align) (org-table-shrink)))
(org-startup-align-all-tables #'org-table-align)
(t #'org-table-shrink))
t))
(when org-startup-with-inline-images (org-display-inline-images))
(when org-startup-with-latex-preview (org-latex-preview '(16)))
(unless org-inhibit-startup-visibility-stuff (org-cycle-set-startup-visibility))