Partially revert "org-mode: Make local variables effective during Org startup"

This reverts commit e22b4eb7aa.

See
https://list.orgmode.org/87r11wkmew.fsf@ucl.ac.uk/T/#mab6359ed2107d5515c6bb6b266551f0c5049ceca

The problem with the commit is that correctly loading local variables
early requires re-implementing all the built-in tricks done by Emacs,
like not enabling local variables in temp buffers or non-file buffers.

In addition, even if we call `hack-local-variables' manually, Emacs
will repeat the normal call later, possibly asking for non-safe
variables twice.

In conclusion, the whole idea of manual triggering local variables is
fragile and should better be handled by Emacs itself via stable API.

testing/.dir-locals.el is kept.
This commit is contained in:
Ihor Radchenko 2022-08-05 19:29:43 +08:00
parent 4702a73031
commit 215de6176b
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
2 changed files with 27 additions and 42 deletions

View File

@ -4712,43 +4712,33 @@ The following commands are available:
\\{org-mode-map}"
(setq-local org-mode-loading t)
;; 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))
(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))
;; Calc embedded
(setq-local calc-embedded-open-mode "# ")
;; Modify a few syntax entries

View File

@ -1,5 +0,0 @@
;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")
;; Stub directory-local file to avoid tests being affected by upper-level settings.