org.el: Fix bug in `org-mark-subtree'

* org.el (org-mark-subtree): Maybe call `org-mark-element'
interactively.
(org-mark-element): Only mark further elements when called
interactively.

For example, M-x org-export RET calls `org-mark-subtree' and
should not mark the further element when an element is already
marked.

Thanks To Bernt Hansen for reporting a bug related to this.
This commit is contained in:
Bastien Guerry 2012-08-20 05:40:25 +02:00
parent 7d117bd981
commit 58a6d823ee
1 changed files with 6 additions and 3 deletions

View File

@ -20748,7 +20748,9 @@ hierarchy of headlines by UP levels before marking the subtree."
((org-before-first-heading-p) (error "Not in a subtree"))
(t (outline-previous-visible-heading 1))))
(when up (while (and (> up 0) (org-up-heading-safe)) (decf up)))
(org-mark-element))
(if (org-called-interactively-p 'any)
(call-interactively 'org-mark-element)
(org-mark-element)))
;;; Indentation
@ -21979,8 +21981,9 @@ ones already marked."
(interactive)
(require 'org-element)
(let (deactivate-mark)
(if (or (and (eq last-command this-command) (mark t))
(and transient-mark-mode mark-active))
(if (and (org-called-interactively-p 'any)
(or (and (eq last-command this-command) (mark t))
(and transient-mark-mode mark-active)))
(set-mark
(save-excursion
(goto-char (mark))