From: Ihor Radchenko <yantar92@gmail.com>
To: m43cap@yandex.com
Cc: emacs-orgmode@gnu.org
Subject: Re: commit e22b4eb7 kills formatting & color
Date: Tue, 02 Aug 2022 21:55:32 +0800 [thread overview]
Message-ID: <87v8rakawb.fsf@localhost> (raw)
In-Reply-To: <877d3qzsc6.fsf@yandex.com>
[-- Attachment #1: Type: text/plain, Size: 322 bytes --]
Colin Baxter <m43cap@yandex.com> writes:
> I disable popups so I always receive a buffer with:
>
> --8<---------------cut here---------------start------------->8---
> The local variables list in test.org
> or .dir-locals.el contains values that may not be safe (*).
Thanks!
Can you try the attached patch?
Best,
Ihor
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-mode-Prevent-early-fontification.patch --]
[-- Type: text/x-patch, Size: 4620 bytes --]
From 8348c62250d2ef92da92416ae13d91289b2abe01 Mon Sep 17 00:00:00 2001
Message-Id: <8348c62250d2ef92da92416ae13d91289b2abe01.1659448323.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Tue, 2 Aug 2022 21:50:20 +0800
Subject: [PATCH] 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 214652364..f8977bba5 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4708,37 +4708,43 @@ (define-derived-mode org-mode outline-mode "Org"
\\{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
--
2.35.1
next prev parent reply other threads:[~2022-08-02 13:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-01 9:44 commit e22b4eb7 kills formatting & color Colin Baxter
2022-08-01 13:02 ` Ihor Radchenko
2022-08-01 13:21 ` Colin Baxter
2022-08-01 13:57 ` Ihor Radchenko
2022-08-01 14:34 ` Colin Baxter
2022-08-01 14:51 ` Colin Baxter
2022-08-02 12:49 ` Ihor Radchenko
2022-08-02 13:29 ` Colin Baxter
2022-08-02 13:55 ` Ihor Radchenko [this message]
2022-08-02 14:49 ` Colin Baxter
2022-08-03 9:40 ` Ihor Radchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87v8rakawb.fsf@localhost \
--to=yantar92@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=m43cap@yandex.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.