Browse Source

org-export: Fix export to subtree

* contrib/lisp/org-export.el (org-export-as): Subtree option was
  ignored.  Also, narrowing to region and to subtree are exclusive.
Nicolas Goaziou 13 years ago
parent
commit
c20402fd14
1 changed files with 3 additions and 5 deletions
  1. 3 5
      contrib/lisp/org-export.el

+ 3 - 5
contrib/lisp/org-export.el

@@ -2065,11 +2065,9 @@ Return code as a string."
   (save-excursion
     (save-restriction
       ;; Narrow buffer to an appropriate region for parsing.
-      (when (org-region-active-p)
-	(narrow-to-region (region-beginning) (region-end)))
-      (when (and subtreep (not (org-at-heading-p)))
-	;; Ensure point is at sub-tree's beginning.
-	(org-narrow-to-subtree))
+      (cond ((org-region-active-p)
+	     (narrow-to-region (region-beginning) (region-end)))
+	    (subtreep (org-narrow-to-subtree)))
       ;; Retrieve export options (INFO) and parsed tree (RAW-DATA),
       ;; Then options can be completed with tree properties.  Note:
       ;; Buffer isn't parsed directly.  Instead, a temporary copy is