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.
This commit is contained in:
Nicolas Goaziou 2012-02-22 19:29:05 +01:00
parent 7f816c6073
commit c20402fd14
1 changed files with 3 additions and 5 deletions

View File

@ -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