diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 4752af373..c5e9cd568 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -86,6 +86,15 @@ order to remain backward-compatible. When region is active and starts at a heading, ~org-metaup~ and ~org-metadown~ will move all the selected subtrees. +*** Many structure editing commands now do not deactivate region + +Moving, promoting, and demoting of headings and items in region now do +not deactivate Transient mark mode. + +Users can thus conveniently select multiple headings/items and use, +for example, =M-=/=M-= repeatedly without losing the +selection. + *** Datetree structure headlines can now be complex TODO state, priority, tags, statistics cookies, and COMMENT keywords diff --git a/lisp/org-list.el b/lisp/org-list.el index 1fc99d070..9fa072ce7 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -2688,7 +2688,8 @@ Return t if successful." (no-subtree (1+ (line-beginning-position))) (t (org-list-get-item-end (line-beginning-position) struct)))))) (let* ((beg (marker-position org-last-indent-begin-marker)) - (end (marker-position org-last-indent-end-marker))) + (end (marker-position org-last-indent-end-marker)) + (deactivate-mark nil)) (cond ;; Special case: moving top-item with indent rule. (specialp diff --git a/lisp/org.el b/lisp/org.el index e68be8f81..407af7251 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -6583,7 +6583,8 @@ headings in the region." (interactive) (save-excursion (if (org-region-active-p) - (org-map-region 'org-promote (region-beginning) (region-end)) + (let ((deactivate-mark nil)) + (org-map-region 'org-promote (region-beginning) (region-end))) (org-promote))) (org-fix-position-after-promote)) @@ -6594,7 +6595,8 @@ headings in the region." (interactive) (save-excursion (if (org-region-active-p) - (org-map-region 'org-demote (region-beginning) (region-end)) + (let ((deactivate-mark nil)) + (org-map-region 'org-demote (region-beginning) (region-end))) (org-demote))) (org-fix-position-after-promote)) @@ -16925,21 +16927,25 @@ for more information." (call-interactively 'org-move-subtree-down))))))) ((org-region-active-p) (let* ((a (save-excursion - (goto-char (region-beginning)) - (line-beginning-position))) - (b (save-excursion - (goto-char (region-end)) - (if (bolp) (1- (point)) (line-end-position)))) - (c (save-excursion - (goto-char a) - (move-beginning-of-line 0) - (point))) - (d (save-excursion - (goto-char a) - (move-end-of-line 0) - (point)))) + (goto-char (region-beginning)) + (line-beginning-position))) + (b (save-excursion + (goto-char (region-end)) + (if (bolp) (1- (point)) (line-end-position)))) + (c (save-excursion + (goto-char a) + (move-beginning-of-line 0) + (point))) + (d (save-excursion + (goto-char a) + (move-end-of-line 0) + (point))) + (deactivate-mark nil) + (swap? (< (point) (mark)))) (transpose-regions a b c d) - (goto-char c))) + (set-mark c) + (goto-char (+ c (- b a))) + (when swap? (exchange-point-and-mark)))) ((org-at-table-p) (org-call-with-arg 'org-table-move-row 'up)) ((and (featurep 'org-inlinetask) (org-inlinetask-in-task-p)) @@ -16980,21 +16986,25 @@ commands for more information." (call-interactively 'org-move-subtree-up))))))) ((org-region-active-p) (let* ((a (save-excursion - (goto-char (region-beginning)) - (line-beginning-position))) + (goto-char (region-beginning)) + (line-beginning-position))) (b (save-excursion - (goto-char (region-end)) - (if (bolp) (1- (point)) (line-end-position)))) + (goto-char (region-end)) + (if (bolp) (1- (point)) (line-end-position)))) (c (save-excursion - (goto-char b) - (move-beginning-of-line (if (bolp) 1 2)) - (point))) + (goto-char b) + (move-beginning-of-line (if (bolp) 1 2)) + (point))) (d (save-excursion - (goto-char b) - (move-end-of-line (if (bolp) 1 2)) - (point)))) + (goto-char b) + (move-end-of-line (if (bolp) 1 2)) + (point))) + (deactivate-mark nil) + (swap? (< (point) (mark)))) (transpose-regions a b c d) - (goto-char d))) + (set-mark (+ 1 a (- d c))) + (goto-char (+ 1 a (- d c) (- b a))) + (when swap? (exchange-point-and-mark)))) ((org-at-table-p) (call-interactively 'org-table-move-row)) ((and (featurep 'org-inlinetask) (org-inlinetask-in-task-p))