Browse Source

Fix bug with including files without markup

File contents that are included with "#+include: file"
should be processed as normal Org stuff.  This used to be so,
and it is so now again.
Carsten Dominik 15 years ago
parent
commit
dfd3749a27
3 changed files with 6 additions and 2 deletions
  1. 1 1
      doc/org.texi
  2. 3 0
      lisp/ChangeLog
  3. 2 1
      lisp/org-exp.el

+ 1 - 1
doc/org.texi

@@ -8265,7 +8265,7 @@ include your @file{.emacs} file, you could use:
 #+INCLUDE: "~/.emacs" src emacs-lisp
 @end example
 @noindent
-The optional second and third parameter are the markup (@samp{quote},
+The optional second and third parameter are the markup (e.g. @samp{quote},
 @samp{example}, or @samp{src}), and, if the markup is @samp{src}, the
 language for formatting the contents.  The markup is optional, if it is not
 given, the text will be assumed to be in Org mode format and will be

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2009-08-07  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-exp.el (org-get-file-contents): Only quote org lines when
+	the markup is src or example.
+
 	* org-agenda.el (org-agenda-skip-scheduled-if-deadline-is-shown):
 	New option
 	(org-agenda-get-day-entries): Remember deadline results and pass

+ 2 - 1
lisp/org-exp.el

@@ -2136,6 +2136,7 @@ If PREFIX is a string, prepend it to each line.  If PREFIX1
 is a string, prepend it to the first line instead of PREFIX.
 If MARKUP, don't protect org-like lines, the exporter will
 take care of the block they are in."
+  (if (stringp markup) (setq markup (downcase markup)))
   (with-temp-buffer
     (insert-file-contents file)
     (when (or prefix prefix1)
@@ -2145,7 +2146,7 @@ take care of the block they are in."
 	(setq prefix1 nil)
 	(beginning-of-line 2)))
     (buffer-string)
-    (unless markup
+    (when (member markup '("src" "example"))
       (goto-char (point-min))
       (while (re-search-forward "^\\(\\*\\|[ \t]*#\\)" nil t)
 	(goto-char (match-beginning 0))