emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Generating an org file actually including the #+INCLUDE files
@ 2010-12-08  9:39 Miguel Ruiz
  2011-02-03 18:04 ` Bastien
  0 siblings, 1 reply; 2+ messages in thread
From: Miguel Ruiz @ 2010-12-08  9:39 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I am working on a document split in several chunks. I need to generate the full document in order to do different sorting processes before exporting.

It would be nice if that generation could be recursive ... you know, one master file, one included file with another included file. 

I suppose orgmode already does this before any exporting. Actually I am asking for an Org export option instead LaTeX or Docbook export. Now, sorry, I am thinking it would be fantastic that noexport tag would be available as well.

How can achieve this?

TIA




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Generating an org file actually including the #+INCLUDE files
  2010-12-08  9:39 Generating an org file actually including the #+INCLUDE files Miguel Ruiz
@ 2011-02-03 18:04 ` Bastien
  0 siblings, 0 replies; 2+ messages in thread
From: Bastien @ 2011-02-03 18:04 UTC (permalink / raw)
  To: Miguel Ruiz; +Cc: emacs-orgmode

Miguel Ruiz <rbenit68@yahoo.es> writes:

> I am working on a document split in several chunks. I need to generate the
> full document in order to do different sorting processes before exporting.
>
> It would be nice if that generation could be recursive ... you know, one
> master file, one included file with another included file.

Crude hack to produce file_include.org based on file.org with some
#+INCLUDE directives:

(defun org-new-file-with-include ()
  "Create a new org file honoring #+INCLUDE directives."
  (interactive)
  (let* ((bfile (buffer-file-name))
	 (bfilenoext (file-name-sans-extension bfile)))
    (find-file-other-window (concat bfilenoext "_include.org"))
    (insert-file bfile)
    (goto-char (point-min))
    (while (re-search-forward "^[ \t]*#\\+INCLUDE:[ \t]*\\(.+\\)[ \t]*$" nil t)
      (let ((ifile (match-string 1)))
	(save-match-data (replace-match ""))
	(insert-file (expand-file-name ifile))))))

Careful: it does not prevent errors when #+INCLUDE directives are
circular...  just a hack.

HTH,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-03 18:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-08  9:39 Generating an org file actually including the #+INCLUDE files Miguel Ruiz
2011-02-03 18:04 ` Bastien

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).