1

I need to include the content of an org file (or a specific section) into my main org file, similarly to what I do in Obsidian with

![[File#Section]] 

I've tried this, but it requires export:

#+INCLUDE: "~/sync/org/notes/perso/orglearn.org"

I've also tried this, but it requires code execution with C-c C-c:

In my emacs config file:

(defun my/org-include-file (file)
"Include the content of FILE in the current buffer."
(insert (format "#+BEGIN_EXAMPLE\n%s\n#+END_EXAMPLE"
(with-temp-buffer
(insert-file-contents file)
(buffer-string)))))

In my file:

#+BEGIN_SRC emacs-lisp :results silent
(my/org-include-file "~/sync/org/notes/perso/orglearn.org")
#+END_SRC

Can you please guide me to have automated inclusion?

Thanks!

2
  • 1
    I'm not aware of any such feature. Note that Emacs has its own SE site at Emacs where you might have better luck. If you choose to post there, please delete this question. Cross-posting isn't permitted. Commented May 25 at 12:09
  • 2
    There are some third-party packages can do this, such as github.com/nobiot/org-transclusion and github.com/yibie/org-include-inline Commented May 25 at 13:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.