* lisp/org-list.el (org-list-indent-item-generic): * lisp/org.el (org-do-promote): (org-do-demote): Do not deactivate mark after edits. (org-metadown): (org-metaup): Do not deactivate mark and do not exchange point and mark in region. --- lisp/org-list.el | 3 ++- lisp/org.el | 64 ++++++++++++++++++++++++++++-------------------- 2 files changed, 39 insertions(+), 28 deletions(-)
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 @@ (defun org-list-indent-item-generic (arg no-subtree struct) (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 59fe3d2d3..58a3434f4 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -6579,7 +6579,8 @@ (defun org-do-promote () (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)) @@ -6590,7 +6591,8 @@ (defun org-do-demote () (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)) @@ -16884,21 +16886,25 @@ (defun org-metaup (&optional _arg) ((run-hook-with-args-until-success 'org-metaup-hook)) ((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)) @@ -16917,21 +16923,25 @@ (defun org-metadown (&optional _arg) ((run-hook-with-args-until-success 'org-metadown-hook)) ((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)) -- 2.39.0