all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Alen Alex Ninan <alenishere@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: [PATCH] Re: Help with assigning org-attach-id-dir using directory local variables
Date: Sat, 11 Jun 2022 19:56:44 +0800	[thread overview]
Message-ID: <87leu3begz.fsf@localhost> (raw)
In-Reply-To: <587be554-906c-5370-2cf2-f08b14fa58ff@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 769 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-mode-Make-local-variables-effective-during-Org-s.patch --]
[-- Type: text/x-patch, Size: 1193 bytes --]

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
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
+  ;; 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


  reply	other threads:[~2022-06-11 11:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-11  0:44 Help with assigning org-attach-id-dir using directory local variables Alen Alex Ninan
2022-06-11 11:56 ` Ihor Radchenko [this message]
2022-07-31 10:25   ` [PATCH] " Ihor Radchenko
2022-08-05 11:55     ` 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=87leu3begz.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=alenishere@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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.