summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2012-09-18 11:09:25 +0200
committerBastien Guerry <bzg@altern.org>2012-09-18 11:09:25 +0200
commit0ca661415469b2434248f96a5fda66f0816f8728 (patch)
tree11d92c6b7db85a4e9d8acae6bfe9e44f5848b494
parenta82797356c8c4e85fa0541479d70719c9f2bb09d (diff)
downloadorg-mode-0ca661415469b2434248f96a5fda66f0816f8728.tar.gz
org-exp.el (org-export): Set the mark correctly when exporting a subtree
* org-exp.el (org-export): Set the mark correctly when exporting a subtree. Thanks to Tyler Smith for reporting this problem.
-rw-r--r--lisp/org-exp.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index d76a295..6b506cd 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -974,6 +974,8 @@ Pressing `1' will switch between these two options."
(let* ((bg (org-xor (equal arg '(16)) org-export-run-in-background))
(subtree-p (or (org-region-active-p)
(eq org-export-initial-scope 'subtree)))
+ (regb (and (org-region-active-p) (region-beginning)))
+ (rege (and (org-region-active-p) (region-end)))
(help "[t] insert the export option template
\[v] limit export to visible part of outline tree
\[1] switch buffer/subtree export
@@ -1054,6 +1056,10 @@ Pressing `1' will switch between these two options."
((not subtree-p)
(setq subtree-p t)
(setq bpos (point))
+ (org-mark-subtree)
+ (org-activate-mark)
+ (setq regb (and (org-region-active-p) (region-beginning)))
+ (setq rege (and (org-region-active-p) (region-end)))
(message "Export subtree: "))))
(when (eq r1 ?\ )
(let ((case-fold-search t)
@@ -1091,8 +1097,9 @@ Pressing `1' will switch between these two options."
"-f" (symbol-name (nth 1 ass)))))
(set-process-sentinel p 'org-export-process-sentinel)
(message "Background process \"%s\": started" p))
- ;; background processing not requested, or not possible
- (if subtree-p (progn (org-mark-subtree) (org-activate-mark)))
+ ;; set the mark correctly when exporting a subtree
+ (if subtree-p (let (deactivate-mark) (push-mark rege t t) (goto-char regb)))
+
(call-interactively (nth 1 ass))
(when (and bpos (get-buffer-window cbuf))
(let ((cw (selected-window)))