Preserve active region after structure edits
* 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. * etc/ORG-NEWS (Datetree structure headlines can now be complex): Announce the change.
This commit is contained in:
parent
b665f8de31
commit
c8a5fef910
|
@ -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-<down>=/=M-<up>= repeatedly without losing the
|
||||
selection.
|
||||
|
||||
*** Datetree structure headlines can now be complex
|
||||
|
||||
TODO state, priority, tags, statistics cookies, and COMMENT keywords
|
||||
|
|
|
@ -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
|
||||
|
|
64
lisp/org.el
64
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))
|
||||
|
|
Loading…
Reference in New Issue