Skip to content

Commit

Permalink
org-mode: Prevent early fontification
Browse files Browse the repository at this point in the history
* lisp/org.el (org-mode): Avoid triggering fontification when
`hack-local-variables' popup window is displayed.  Font-lock settings
are not configured yet at this point.

Fixes https://orgmode.org/list/87r120kodw.fsf@yandex.com
  • Loading branch information
yantar92 committed Aug 3, 2022
1 parent 5a49cc5 commit fde93ab
Showing 1 changed file with 37 additions and 31 deletions.
68 changes: 37 additions & 31 deletions lisp/org.el
Original file line number Diff line number Diff line change
Expand Up @@ -4708,37 +4708,43 @@ The following commands are available:

\\{org-mode-map}"
(setq-local org-mode-loading t)
;; Apply file-local and directory-local variables, so that Org
;; startup respects them. See
;; https://list.orgmode.org/587be554-906c-5370-2cf2-f08b14fa58ff@gmail.com/T/#u
(hack-local-variables 'ignore-mode-settings)
(org-load-modules-maybe)
(org-install-agenda-files-menu)
(when (and org-link-descriptive
(eq org-fold-core-style 'overlays))
(add-to-invisibility-spec '(org-link)))
(org-fold-initialize (or (and (stringp org-ellipsis) (not (equal "" org-ellipsis)) org-ellipsis)
"..."))
(make-local-variable 'org-link-descriptive)
(when (eq org-fold-core-style 'overlays) (add-to-invisibility-spec '(org-hide-block . t)))
(if org-link-descriptive
(org-fold-core-set-folding-spec-property (car org-link--link-folding-spec) :visible nil)
(org-fold-core-set-folding-spec-property (car org-link--link-folding-spec) :visible t))
(setq-local outline-regexp org-outline-regexp)
(setq-local outline-level 'org-outline-level)
(when (and (stringp org-ellipsis) (not (equal "" org-ellipsis)))
(unless org-display-table
(setq org-display-table (make-display-table)))
(set-display-table-slot
org-display-table 4
(vconcat (mapcar (lambda (c) (make-glyph-code c 'org-ellipsis))
org-ellipsis)))
(setq buffer-display-table org-display-table))
(org-set-regexps-and-options)
(org-set-font-lock-defaults)
(when (and org-tag-faces (not org-tags-special-faces-re))
;; tag faces set outside customize.... force initialization.
(org-set-tag-faces 'org-tag-faces org-tag-faces))
;; Disable `font-lock-mode' temporarily to delay fontification in case if
;; `hack-local-variables' shows a popup window. Such a popup causes
;; redisplay and triggers fontification too early.
(let ((org-font-lock-enabled-p font-lock-mode))
(font-lock-mode -1)
;; Apply file-local and directory-local variables, so that Org
;; startup respects them. See
;; https://list.orgmode.org/587be554-906c-5370-2cf2-f08b14fa58ff@gmail.com/T/#u
(hack-local-variables 'ignore-mode-settings)
(org-load-modules-maybe)
(org-install-agenda-files-menu)
(when (and org-link-descriptive
(eq org-fold-core-style 'overlays))
(add-to-invisibility-spec '(org-link)))
(org-fold-initialize (or (and (stringp org-ellipsis) (not (equal "" org-ellipsis)) org-ellipsis)
"..."))
(make-local-variable 'org-link-descriptive)
(when (eq org-fold-core-style 'overlays) (add-to-invisibility-spec '(org-hide-block . t)))
(if org-link-descriptive
(org-fold-core-set-folding-spec-property (car org-link--link-folding-spec) :visible nil)
(org-fold-core-set-folding-spec-property (car org-link--link-folding-spec) :visible t))
(setq-local outline-regexp org-outline-regexp)
(setq-local outline-level 'org-outline-level)
(when (and (stringp org-ellipsis) (not (equal "" org-ellipsis)))
(unless org-display-table
(setq org-display-table (make-display-table)))
(set-display-table-slot
org-display-table 4
(vconcat (mapcar (lambda (c) (make-glyph-code c 'org-ellipsis))
org-ellipsis)))
(setq buffer-display-table org-display-table))
(org-set-regexps-and-options)
(org-set-font-lock-defaults)
(when (and org-tag-faces (not org-tags-special-faces-re))
;; tag faces set outside customize.... force initialization.
(org-set-tag-faces 'org-tag-faces org-tag-faces))
(font-lock-mode org-font-lock-enabled-p))
;; Calc embedded
(setq-local calc-embedded-open-mode "# ")
;; Modify a few syntax entries
Expand Down

0 comments on commit fde93ab

Please sign in to comment.