Conclusion of ISO in emacs org-mode?

Q: is there a way to do switching in org-mode emacs?

By "transition" I mean things like, for example, in fileA.org and fileB.org, including "fileInc.org" and the presence of a tree from fileInc.org in both places. Actually appear, not just connected. (Perhaps, with conditional inclusion, transformation, for example, the depth of nesting (quantity *** s)).

I know about #setupfile, but it seems that this only works for modes, not for real text.

I know about http://orgmode.org/manual/Include-files.html , but AFAIK they only work when exported.

I am looking for something that works in a regular org-mode emacs buffer. (In fact, something that worked in non-org-mode buffers might be nice.)

I have a boiler stove that I want to include in several files.

Is there something similar?

+5
source share
1 answer

Hmm ... I don’t think something like that exists, but it was easy enough to write a dynamic block for this. The following elisp works for me:

(defun org-dblock-write:transclusion (params)
  (progn
    (with-temp-buffer
      (insert-file-contents (plist-get params :filename))
      (let ((range-start (or (plist-get params :min) (line-number-at-pos (point-min))))
            (range-end (or (plist-get params :max) (line-number-at-pos (point-max)))))
        (copy-region-as-kill (line-beginning-position range-start)
                             (line-end-position range-end))))
    (yank)))

Then, to include a range of lines from a given file, you can create a dynamic block as follows:

 #+BEGIN: transclusion :filename "~/testfile.org" :min 2 :max 4
 #+END:

And auto-complete with C-c C-x C-u. Skip min and max args to include the entire file. Note that you can snap org-update-all-dblocksto a hook so that this range is updated whenever you visit a file or save.

http://orgmode.org/org.html#Dynamic-blocks. , !

+7

All Articles