emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org fde93abb8c: org-mode: Prevent early fontification


From: ELPA Syncer
Subject: [elpa] externals/org fde93abb8c: org-mode: Prevent early fontification
Date: Wed, 3 Aug 2022 05:57:56 -0400 (EDT)

branch: externals/org
commit fde93abb8c490bc2e0a1fe1d7a23127669bbc90e
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>

    org-mode: Prevent early fontification
    
    * 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
---
 lisp/org.el | 68 +++++++++++++++++++++++++++++++++----------------------------
 1 file changed, 37 insertions(+), 31 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 2146523641..f8977bba58 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]