Przeglądaj źródła

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.
Bastien Guerry 12 lat temu
rodzic
commit
58a6d823ee
1 zmienionych plików z 6 dodań i 3 usunięć
  1. 6 3
      lisp/org.el

+ 6 - 3
lisp/org.el

@@ -20748,7 +20748,9 @@ hierarchy of headlines by UP levels before marking the subtree."
 	 ((org-before-first-heading-p) (error "Not in a subtree"))
 	 ((org-before-first-heading-p) (error "Not in a subtree"))
 	 (t (outline-previous-visible-heading 1))))
 	 (t (outline-previous-visible-heading 1))))
   (when up (while (and (> up 0) (org-up-heading-safe)) (decf up)))
   (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
 ;;; Indentation
 
 
@@ -21979,8 +21981,9 @@ ones already marked."
   (interactive)
   (interactive)
   (require 'org-element)
   (require 'org-element)
   (let (deactivate-mark)
   (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
 	(set-mark
 	 (save-excursion
 	 (save-excursion
 	   (goto-char (mark))
 	   (goto-char (mark))