[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Re: Help with assigning org-attach-id-dir using directory local
From: |
Ihor Radchenko |
Subject: |
[PATCH] Re: Help with assigning org-attach-id-dir using directory local variables |
Date: |
Sat, 11 Jun 2022 19:56:44 +0800 |
Alen Alex Ninan <alenishere@gmail.com> writes:
> 1. Have I made an error in how I define the directory local file?
No.
> 2. If I have not made and error, Is it possible to define the attachment
> directory in directory local variable and have org mode respect the
> location when display of inline images are enabled during startup?
The problem you are seeing is because Emacs assigns directory-local and
buffer-local variables _after_ Org mode (or any other major mode) is
loaded.
Org startup staff happens during loading before directory-local
variables are assigned. Hence error.
I've seen multiple issues coming from the above behavior.
Hence, I'd like to propose Org to call `hack-local-variables' early
during startup. The patch is attached.
Best,
Ihor
>From 85af884fcb70cda42acd4cb1610411dcacac82b9 Mon Sep 17 00:00:00 2001
Message-Id:
<85af884fcb70cda42acd4cb1610411dcacac82b9.1654948539.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Sat, 11 Jun 2022 19:53:37 +0800
Subject: [PATCH] org-mode: Make local variables effective during Org startup
* lisp/org.el (org-mode): Call `hack-local-variables' early during Org
mode startup. This way, Org startup options will regard local
variable settings.
Fixes
587be554-906c-5370-2cf2-f08b14fa58ff@gmail.com/T/#u">https://list.orgmode.org/587be554-906c-5370-2cf2-f08b14fa58ff@gmail.com/T/#u
---
lisp/org.el | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lisp/org.el b/lisp/org.el
index 080962cdb..2b8a6cd10 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4606,6 +4606,10 @@ (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
+ ;;
587be554-906c-5370-2cf2-f08b14fa58ff@gmail.com/T/#u">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
--
2.35.1