* [PATCH 0/4] Structure editing when region is active
@ 2023-01-15 12:31 Ihor Radchenko
2023-01-15 12:31 ` [PATCH 1/4] Preserve active region after structure edits Ihor Radchenko
` (5 more replies)
0 siblings, 6 replies; 20+ messages in thread
From: Ihor Radchenko @ 2023-01-15 12:31 UTC (permalink / raw)
To: emacs-orgmode; +Cc: Ihor Radchenko
Hi,
I'd like to propose a patchset that addresses some issues raised in
https://teddit.zaggy.nl/r/orgmode/comments/10b6ue6/orgmode_is_so_bad_at_rearranging_items_in_an/
1. When acting on region, promotion, demotion, and other structure
editing commands immediately deactivate selection. It is annoying
when one wants to promote several headings togetehr multiple times.
2. M-<up>/<down> on region does not care if there are headings inside
region and simply treats region as plain text:
* Heading 1
text
** Sub
* <mark>Heading 2
* Heading 3<point>
{M-<up>}
* Heading 1
text
* Heading 2
* Heading 3
** Sub
The patchset below addresses (2) by making org-metaup/org-metadown
aware of headings in region (when region starts at heading).
In addition, it alters M-<left>/M-<right>/M-<up>/M-<down> to not
deactivate active selection (Transient mark mode). This way, one can
issue, say, M-<right> repeatedly without having to re-select
everything.
Similarly, bulk editing commands like setting schedule, deadline,
tags, and todo do not deactivate region.
I'd appreciate testing on edge cases and ideas for tests.
Ihor Radchenko (4):
Preserve active region after structure edits
Preserve active region when toggling heading state
org-metaup, org-metadown: Move subtrees in active region
org-manual.org: Document changes in 8f6fcd709, 5719a8163, and
eda9909a9
etc/ORG-NEWS | 20 ++++++
lisp/org-list.el | 3 +-
lisp/org.el | 146 +++++++++++++++++++++++++++------------
testing/lisp/test-org.el | 54 +++++++++++++++
4 files changed, 179 insertions(+), 44 deletions(-)
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 1/4] Preserve active region after structure edits
2023-01-15 12:31 [PATCH 0/4] Structure editing when region is active Ihor Radchenko
@ 2023-01-15 12:31 ` Ihor Radchenko
2023-01-15 12:31 ` [PATCH 2/4] Preserve active region when toggling heading state Ihor Radchenko
` (4 subsequent siblings)
5 siblings, 0 replies; 20+ messages in thread
From: Ihor Radchenko @ 2023-01-15 12:31 UTC (permalink / raw)
To: emacs-orgmode; +Cc: Ihor Radchenko
* 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
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 2/4] Preserve active region when toggling heading state
2023-01-15 12:31 [PATCH 0/4] Structure editing when region is active Ihor Radchenko
2023-01-15 12:31 ` [PATCH 1/4] Preserve active region after structure edits Ihor Radchenko
@ 2023-01-15 12:31 ` Ihor Radchenko
2023-01-15 12:31 ` [PATCH 3/4] org-metaup, org-metadown: Move subtrees in active region Ihor Radchenko
` (3 subsequent siblings)
5 siblings, 0 replies; 20+ messages in thread
From: Ihor Radchenko @ 2023-01-15 12:31 UTC (permalink / raw)
To: emacs-orgmode; +Cc: Ihor Radchenko
* lisp/org.el (org-todo):
(org-deadline):
(org-schedule):
(org-set-tags-command): Do not deactivate region after applying edits.
---
lisp/org.el | 36 ++++++++++++++++++++----------------
1 file changed, 20 insertions(+), 16 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index 58a3434f4..9fd8189a7 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9184,7 +9184,8 @@ (defun org-todo (&optional arg)
(if (and (org-region-active-p) org-loop-over-headlines-in-active-region)
(let ((cl (if (eq org-loop-over-headlines-in-active-region 'start-level)
'region-start-level 'region))
- org-loop-over-headlines-in-active-region)
+ org-loop-over-headlines-in-active-region
+ (deactivate-mark nil))
(org-map-entries
(lambda () (org-todo arg))
nil cl
@@ -10155,13 +10156,14 @@ (defun org-deadline (arg &optional time)
can either be an Org date like \"2011-07-24\" or a delta like \"+2d\"."
(interactive "P")
(if (and (org-region-active-p) org-loop-over-headlines-in-active-region)
- (org-map-entries
- (lambda () (org--deadline-or-schedule arg 'deadline time))
- nil
- (if (eq org-loop-over-headlines-in-active-region 'start-level)
- 'region-start-level
- 'region)
- (lambda () (when (org-invisible-p) (org-end-of-subtree nil t))))
+ (let ((deactivate-mark nil))
+ (org-map-entries
+ (lambda () (org--deadline-or-schedule arg 'deadline time))
+ nil
+ (if (eq org-loop-over-headlines-in-active-region 'start-level)
+ 'region-start-level
+ 'region)
+ (lambda () (when (org-invisible-p) (org-end-of-subtree nil t)))))
(org--deadline-or-schedule arg 'deadline time)))
(defun org-schedule (arg &optional time)
@@ -10176,13 +10178,14 @@ (defun org-schedule (arg &optional time)
either be an Org date like \"2011-07-24\" or a delta like \"+2d\"."
(interactive "P")
(if (and (org-region-active-p) org-loop-over-headlines-in-active-region)
- (org-map-entries
- (lambda () (org--deadline-or-schedule arg 'scheduled time))
- nil
- (if (eq org-loop-over-headlines-in-active-region 'start-level)
- 'region-start-level
- 'region)
- (lambda () (when (org-invisible-p) (org-end-of-subtree nil t))))
+ (let ((deactivate-mark nil))
+ (org-map-entries
+ (lambda () (org--deadline-or-schedule arg 'scheduled time))
+ nil
+ (if (eq org-loop-over-headlines-in-active-region 'start-level)
+ 'region-start-level
+ 'region)
+ (lambda () (when (org-invisible-p) (org-end-of-subtree nil t)))))
(org--deadline-or-schedule arg 'scheduled time)))
(defun org-get-scheduled-time (pom &optional inherit)
@@ -11633,7 +11636,8 @@ (defun org-set-tags-command (&optional arg)
((and (org-region-active-p) org-loop-over-headlines-in-active-region)
(let ((cl (if (eq org-loop-over-headlines-in-active-region 'start-level)
'region-start-level 'region))
- org-loop-over-headlines-in-active-region) ; hint: infinite recursion.
+ org-loop-over-headlines-in-active-region ; hint: infinite recursion.
+ (deactivate-mark nil))
(org-map-entries
#'org-set-tags-command
nil cl
--
2.39.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 3/4] org-metaup, org-metadown: Move subtrees in active region
2023-01-15 12:31 [PATCH 0/4] Structure editing when region is active Ihor Radchenko
2023-01-15 12:31 ` [PATCH 1/4] Preserve active region after structure edits Ihor Radchenko
2023-01-15 12:31 ` [PATCH 2/4] Preserve active region when toggling heading state Ihor Radchenko
@ 2023-01-15 12:31 ` Ihor Radchenko
2023-01-15 12:31 ` [PATCH 4/4] org-manual.org: Document changes in 8f6fcd709, 5719a8163, and eda9909a9 Ihor Radchenko
` (2 subsequent siblings)
5 siblings, 0 replies; 20+ messages in thread
From: Ihor Radchenko @ 2023-01-15 12:31 UTC (permalink / raw)
To: emacs-orgmode; +Cc: Ihor Radchenko
* lisp/org.el (org-metaup):
(org-metadown): When active region contains headings, move the
containing subtrees according to the selection. Do not deactive
region.
* testing/lisp/test-org.el (test-org/move-subtree): Add test.
---
lisp/org.el | 46 ++++++++++++++++++++++++++++++++++
testing/lisp/test-org.el | 54 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 100 insertions(+)
diff --git a/lisp/org.el b/lisp/org.el
index 9fd8189a7..0c782769d 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16888,6 +16888,30 @@ (defun org-metaup (&optional _arg)
(interactive "P")
(cond
((run-hook-with-args-until-success 'org-metaup-hook))
+ ((and (org-region-active-p)
+ (org-with-limited-levels
+ (save-excursion
+ (goto-char (region-beginning))
+ (org-at-heading-p))))
+ (when (org-check-for-hidden 'headlines) (org-hidden-tree-error))
+ (let ((beg (region-beginning))
+ (end (region-end)))
+ (save-excursion
+ (goto-char end)
+ (setq end (point-marker))
+ (goto-char beg)
+ (let ((level (org-current-level)))
+ (when (or (and (> level 1) (re-search-forward (format "^\\*\\{1,%s\\} " (1- level)) end t))
+ ;; Search previous subtree.
+ (progn
+ (goto-char beg)
+ (beginning-of-line)
+ (not (re-search-backward (format "^\\*\\{%s\\} " level) nil t))))
+ (user-error "Cannot move past superior level or buffer limit"))
+ ;; Drag first subtree above below the selected.
+ (while (< (point) end)
+ (let ((deactivate-mark nil))
+ (call-interactively 'org-move-subtree-down)))))))
((org-region-active-p)
(let* ((a (save-excursion
(goto-char (region-beginning))
@@ -16925,6 +16949,28 @@ (defun org-metadown (&optional _arg)
(interactive "P")
(cond
((run-hook-with-args-until-success 'org-metadown-hook))
+ ((and (org-region-active-p)
+ (org-with-limited-levels
+ (save-excursion
+ (goto-char (region-beginning))
+ (org-at-heading-p))))
+ (when (org-check-for-hidden 'headlines) (org-hidden-tree-error))
+ (let ((beg (region-beginning))
+ (end (region-end)))
+ (save-excursion
+ (goto-char beg)
+ (setq beg (point-marker))
+ (let ((level (org-current-level)))
+ (when (or (and (> level 1) (re-search-forward (format "^\\*\\{1,%s\\} " (1- level)) end t))
+ ;; Search next subtree.
+ (progn
+ (goto-char end)
+ (not (re-search-forward (format "^\\*\\{%s\\} " level) nil t))))
+ (user-error "Cannot move past superior level or buffer limit"))
+ ;; Drag first subtree below above the selected.
+ (while (> (point) beg)
+ (let ((deactivate-mark nil))
+ (call-interactively 'org-move-subtree-up)))))))
((org-region-active-p)
(let* ((a (save-excursion
(goto-char (region-beginning))
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 7ed4ffd19..4c66fa038 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -5091,6 +5091,60 @@ (ert-deftest test-org/previous-block ()
\f
;;; Outline structure
+(ert-deftest test-org/move-subtree ()
+ "Test `org-metaup' and `org-metadown' on headings."
+ (should
+ (equal "* H2\n* H1\n"
+ (org-test-with-temp-text "* H1<point>\n* H2\n"
+ (org-metadown)
+ (buffer-string))))
+ (should
+ (equal "* H2\n* H1\n"
+ (org-test-with-temp-text "* H1\n* H2<point>\n"
+ (org-metaup)
+ (buffer-string))))
+ (should-error
+ (org-test-with-temp-text "* H1\n* H2<point>\n"
+ (org-metadown)
+ (buffer-string)))
+ (should-error
+ (org-test-with-temp-text "* H1<point>\n* H2\n"
+ (org-metaup)
+ (buffer-string)))
+ (should-error
+ (org-test-with-temp-text "* H1\n** H1.2<point>\n* H2"
+ (org-metadown)
+ (buffer-string)))
+ (should-error
+ (org-test-with-temp-text "* H1\n** H1.2<point>\n"
+ (org-metaup)
+ (buffer-string)))
+ ;; With selection
+ (should
+ (equal "* T\n** H3\n** H1\n** H2\n"
+ (org-test-with-temp-text "* T\n** <point>H1\n** H2\n** H3\n"
+ (set-mark (point))
+ (search-forward "H2")
+ (org-metadown)
+ (buffer-string))))
+ (should
+ (equal "* T\n** H1\n** H2\n** H0\n** H3\n"
+ (org-test-with-temp-text "* T\n** H0\n** <point>H1\n** H2\n** H3\n"
+ (set-mark (point))
+ (search-forward "H2")
+ (org-metaup)
+ (buffer-string))))
+ (should-error
+ (org-test-with-temp-text "* T\n** <point>H1\n** H2\n* T2\n"
+ (set-mark (point))
+ (search-forward "H2")
+ (org-metadown)))
+ (should-error
+ (org-test-with-temp-text "* T\n** <point>H1\n** H2\n* T2\n"
+ (set-mark (point))
+ (search-forward "H2")
+ (org-metaup))))
+
(ert-deftest test-org/demote ()
"Test `org-demote' specifications."
;; Add correct number of stars according to `org-odd-levels-only'.
--
2.39.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 4/4] org-manual.org: Document changes in 8f6fcd709, 5719a8163, and eda9909a9
2023-01-15 12:31 [PATCH 0/4] Structure editing when region is active Ihor Radchenko
` (2 preceding siblings ...)
2023-01-15 12:31 ` [PATCH 3/4] org-metaup, org-metadown: Move subtrees in active region Ihor Radchenko
@ 2023-01-15 12:31 ` Ihor Radchenko
2023-01-16 0:24 ` [PATCH 0/4] Structure editing when region is active Samuel Wales
2023-02-04 13:54 ` Ihor Radchenko
5 siblings, 0 replies; 20+ messages in thread
From: Ihor Radchenko @ 2023-01-15 12:31 UTC (permalink / raw)
To: emacs-orgmode; +Cc: Ihor Radchenko
* etc/ORG-NEWS (~org-metaup~ and ~org-metadown~ now act on headings in region):
(Many structure editing commands now do not deactivate region):
Document new features when editing headings in region.
---
etc/ORG-NEWS | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index c5d9bdf6e..be918a45a 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -12,6 +12,26 @@ See the end of the file for license conditions.
Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
* Version 9.7 (not released yet)
+** New features
+*** 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.
+
+The same applies to setting heading states in region when
+~org-loop-over-headlines-in-active-region~ is non-nil. ~org-todo~,
+~org-schedule~, ~org-deadline~, and ~org-set-tags-command~ are all
+affected.
+
+*** ~org-metaup~ and ~org-metadown~ now act on headings in region
+
+When region is active and starts at a heading, ~org-metaup~ and
+~org-metadown~ will move all the selected subtrees.
+
** New options
*** New options for the "csl" citation export processor's LaTeX output
--
2.39.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 0/4] Structure editing when region is active
2023-01-15 12:31 [PATCH 0/4] Structure editing when region is active Ihor Radchenko
` (3 preceding siblings ...)
2023-01-15 12:31 ` [PATCH 4/4] org-manual.org: Document changes in 8f6fcd709, 5719a8163, and eda9909a9 Ihor Radchenko
@ 2023-01-16 0:24 ` Samuel Wales
2023-01-16 11:17 ` Ihor Radchenko
2023-02-04 13:54 ` Ihor Radchenko
5 siblings, 1 reply; 20+ messages in thread
From: Samuel Wales @ 2023-01-16 0:24 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
not really related, but wrt structure editing, is there anything that
preserves integrity of levels? [my old maint version allows double
demotion [perhaps this is related to inline tasks], and i wonder about
org-yank, and org-lint does not complain.]
i have encountered cases in org where i find it annoying htat i hae to
c-g to stop transient mark mode. will report if able.
On 1/15/23, Ihor Radchenko <yantar92@posteo.net> wrote:
> Hi,
>
> I'd like to propose a patchset that addresses some issues raised in
> https://teddit.zaggy.nl/r/orgmode/comments/10b6ue6/orgmode_is_so_bad_at_rearranging_items_in_an/
>
> 1. When acting on region, promotion, demotion, and other structure
> editing commands immediately deactivate selection. It is annoying
> when one wants to promote several headings togetehr multiple times.
>
> 2. M-<up>/<down> on region does not care if there are headings inside
> region and simply treats region as plain text:
>
> * Heading 1
> text
> ** Sub
> * <mark>Heading 2
> * Heading 3<point>
>
> {M-<up>}
>
> * Heading 1
> text
> * Heading 2
> * Heading 3
> ** Sub
>
> The patchset below addresses (2) by making org-metaup/org-metadown
> aware of headings in region (when region starts at heading).
>
> In addition, it alters M-<left>/M-<right>/M-<up>/M-<down> to not
> deactivate active selection (Transient mark mode). This way, one can
> issue, say, M-<right> repeatedly without having to re-select
> everything.
>
> Similarly, bulk editing commands like setting schedule, deadline,
> tags, and todo do not deactivate region.
>
> I'd appreciate testing on edge cases and ideas for tests.
>
> Ihor Radchenko (4):
> Preserve active region after structure edits
> Preserve active region when toggling heading state
> org-metaup, org-metadown: Move subtrees in active region
> org-manual.org: Document changes in 8f6fcd709, 5719a8163, and
> eda9909a9
>
> etc/ORG-NEWS | 20 ++++++
> lisp/org-list.el | 3 +-
> lisp/org.el | 146 +++++++++++++++++++++++++++------------
> testing/lisp/test-org.el | 54 +++++++++++++++
> 4 files changed, 179 insertions(+), 44 deletions(-)
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>
>
>
>
--
The Kafka Pandemic
A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 0/4] Structure editing when region is active
2023-01-16 0:24 ` [PATCH 0/4] Structure editing when region is active Samuel Wales
@ 2023-01-16 11:17 ` Ihor Radchenko
2023-01-17 1:45 ` Samuel Wales
0 siblings, 1 reply; 20+ messages in thread
From: Ihor Radchenko @ 2023-01-16 11:17 UTC (permalink / raw)
To: Samuel Wales; +Cc: emacs-orgmode
Samuel Wales <samologist@gmail.com> writes:
> not really related, but wrt structure editing, is there anything that
> preserves integrity of levels? [my old maint version allows double
> demotion [perhaps this is related to inline tasks], and i wonder about
> org-yank, and org-lint does not complain.]
Sorry, but I do not understand what you are referring to.
Note that "maint", if it is a real branch name, is ancient and no longer
used upstream.
> i have encountered cases in org where i find it annoying htat i hae to
> c-g to stop transient mark mode. will report if able.
Yes, please. I am not sure about the patch 2/4 in particular that does
not deactivate Transient mark mode when setting TODO state, tags,
schedule, and deadlines. Do people need these? Maybe in some other
commands? Maybe we can make it into a custom setting?
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 0/4] Structure editing when region is active
2023-01-16 11:17 ` Ihor Radchenko
@ 2023-01-17 1:45 ` Samuel Wales
2023-01-17 9:46 ` Ihor Radchenko
0 siblings, 1 reply; 20+ messages in thread
From: Samuel Wales @ 2023-01-17 1:45 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
oh i was just saying what does modern org e.g. main have for ensuring
star structure integrity, if anything. i have a git commit that has
something similar to:
* one
****** two
which seemed slightly relevant to the patch.
do i misunderstand? i set region, then set todo kw, which loops me
manually through the region. when the last todo kw is chosen, the
active region disappears.i personally would find it annoying if
transient mark mode stuck around. fwiw.
On 1/16/23, Ihor Radchenko <yantar92@posteo.net> wrote:
> Samuel Wales <samologist@gmail.com> writes:
>
>> not really related, but wrt structure editing, is there anything that
>> preserves integrity of levels? [my old maint version allows double
>> demotion [perhaps this is related to inline tasks], and i wonder about
>> org-yank, and org-lint does not complain.]
>
> Sorry, but I do not understand what you are referring to.
> Note that "maint", if it is a real branch name, is ancient and no longer
> used upstream.
>
>> i have encountered cases in org where i find it annoying htat i hae to
>> c-g to stop transient mark mode. will report if able.
>
> Yes, please. I am not sure about the patch 2/4 in particular that does
> not deactivate Transient mark mode when setting TODO state, tags,
> schedule, and deadlines. Do people need these? Maybe in some other
> commands? Maybe we can make it into a custom setting?
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>
--
The Kafka Pandemic
A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 0/4] Structure editing when region is active
2023-01-17 1:45 ` Samuel Wales
@ 2023-01-17 9:46 ` Ihor Radchenko
2023-01-18 1:11 ` Samuel Wales
0 siblings, 1 reply; 20+ messages in thread
From: Ihor Radchenko @ 2023-01-17 9:46 UTC (permalink / raw)
To: Samuel Wales; +Cc: emacs-orgmode
Samuel Wales <samologist@gmail.com> writes:
> oh i was just saying what does modern org e.g. main have for ensuring
> star structure integrity, if anything. i have a git commit that has
> something similar to:
>
> * one
> ****** two
>
> which seemed slightly relevant to the patch.
Sorry, but could you further elaborate? What kind of integrity and what
kind of structure editing do you have in mind here?
> do i misunderstand? i set region, then set todo kw, which loops me
> manually through the region. when the last todo kw is chosen, the
> active region disappears.i personally would find it annoying if
> transient mark mode stuck around. fwiw.
Fair point. I guess the same holds for scheduling/setting deadlines/tags.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 0/4] Structure editing when region is active
2023-01-17 9:46 ` Ihor Radchenko
@ 2023-01-18 1:11 ` Samuel Wales
2023-01-18 10:14 ` Ihor Radchenko
0 siblings, 1 reply; 20+ messages in thread
From: Samuel Wales @ 2023-01-18 1:11 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
On 1/17/23, Ihor Radchenko <yantar92@posteo.net> wrote:
>> * one
>> ****** two
>>
>> which seemed slightly relevant to the patch.
>
> Sorry, but could you further elaborate? What kind of integrity and what
> kind of structure editing do you have in mind here?
maybe my comment is too unrelated to the patch, but it just seemed
worth raising in the context. to me it feels wrong to have a
non-linline-task child entry whose heading is star-indented more
levels than needed to denote a child entry.
in my own case, it suggests corruption, because i would not
deliberately create that. i have encountered it. similarly if
org-odd-levels-only is non-nil and there is an even star heading. i
have encountered it. confusing to track down.
i was merely asking if there was anything in e.g. main or syntax
documents etc. that refers to or enforces this.
as for active region or transient mark, to me, they are supposed to be
transient, unlike, for example, agenda restriction lock, and thus, for
example, having to c-g or so to get rid of a highlighted region feels
like a bug.
there might be exceptions where you pretty much always want to run a
command more than once with the region remaining active, perhaps such
as a rectange opening type of command, but to me the patch commands do
not apply there.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 0/4] Structure editing when region is active
2023-01-18 1:11 ` Samuel Wales
@ 2023-01-18 10:14 ` Ihor Radchenko
2023-02-04 22:45 ` Samuel Wales
0 siblings, 1 reply; 20+ messages in thread
From: Ihor Radchenko @ 2023-01-18 10:14 UTC (permalink / raw)
To: Samuel Wales; +Cc: emacs-orgmode
Samuel Wales <samologist@gmail.com> writes:
> maybe my comment is too unrelated to the patch, but it just seemed
> worth raising in the context. to me it feels wrong to have a
> non-linline-task child entry whose heading is star-indented more
> levels than needed to denote a child entry.
>
> in my own case, it suggests corruption, because i would not
> deliberately create that. i have encountered it. similarly if
> org-odd-levels-only is non-nil and there is an even star heading. i
> have encountered it. confusing to track down.
>
> i was merely asking if there was anything in e.g. main or syntax
> documents etc. that refers to or enforces this.
I have seen some checks in the code to ensure not breaking structure.
They may not be ideal, indeed. Hard to say much without a reproducer.
> as for active region or transient mark, to me, they are supposed to be
> transient, unlike, for example, agenda restriction lock, and thus, for
> example, having to c-g or so to get rid of a highlighted region feels
> like a bug.
>
> there might be exceptions where you pretty much always want to run a
> command more than once with the region remaining active, perhaps such
> as a rectange opening type of command, but to me the patch commands do
> not apply there.
The patch is mostly aiming at M-arrow commands.
I feel like M-arrow are issued repeatedly quite often.
We may also provide a defcustom. Though I will be in favour of keeping
"do not deactivate selection" as the default of such defcustom.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 0/4] Structure editing when region is active
2023-01-15 12:31 [PATCH 0/4] Structure editing when region is active Ihor Radchenko
` (4 preceding siblings ...)
2023-01-16 0:24 ` [PATCH 0/4] Structure editing when region is active Samuel Wales
@ 2023-02-04 13:54 ` Ihor Radchenko
2023-02-06 21:00 ` Rudolf Adamkovič
5 siblings, 1 reply; 20+ messages in thread
From: Ihor Radchenko @ 2023-02-04 13:54 UTC (permalink / raw)
To: emacs-orgmode
Ihor Radchenko <yantar92@posteo.net> writes:
> I'd like to propose a patchset that addresses some issues raised in
> https://teddit.zaggy.nl/r/orgmode/comments/10b6ue6/orgmode_is_so_bad_at_rearranging_items_in_an/
>
> 1. When acting on region, promotion, demotion, and other structure
> editing commands immediately deactivate selection. It is annoying
> when one wants to promote several headings togetehr multiple times.
>
> 2. M-<up>/<down> on region does not care if there are headings inside
> region and simply treats region as plain text:
Applied, onto main, dropping the patch to preserve region upon setting
heading state. I also merged the NEWS patch into the corresponding
feature patches.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=b665f8de3
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=c8a5fef91
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 0/4] Structure editing when region is active
2023-01-18 10:14 ` Ihor Radchenko
@ 2023-02-04 22:45 ` Samuel Wales
2023-02-05 11:11 ` Ihor Radchenko
0 siblings, 1 reply; 20+ messages in thread
From: Samuel Wales @ 2023-02-04 22:45 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
thanks for the patches. out of curiosity, does e.g. m-up m-up up deactivate?
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 0/4] Structure editing when region is active
2023-02-04 22:45 ` Samuel Wales
@ 2023-02-05 11:11 ` Ihor Radchenko
0 siblings, 0 replies; 20+ messages in thread
From: Ihor Radchenko @ 2023-02-05 11:11 UTC (permalink / raw)
To: Samuel Wales; +Cc: emacs-orgmode
Samuel Wales <samologist@gmail.com> writes:
> thanks for the patches. out of curiosity, does e.g. m-up m-up up deactivate?
No. The patches make M-<up>/<down>/<left>/<right> not deactivate.
Nothing else is affected.
If there are use-cases when these commands should deactivate, please share
them.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 0/4] Structure editing when region is active
2023-02-04 13:54 ` Ihor Radchenko
@ 2023-02-06 21:00 ` Rudolf Adamkovič
2023-02-07 10:56 ` Ihor Radchenko
0 siblings, 1 reply; 20+ messages in thread
From: Rudolf Adamkovič @ 2023-02-06 21:00 UTC (permalink / raw)
To: Ihor Radchenko, emacs-orgmode
Ihor Radchenko <yantar92@posteo.net> writes:
> Applied, onto main, dropping the patch to preserve region upon setting
> heading state. I also merged the NEWS patch into the corresponding
> feature patches.
>
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=b665f8de3
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=c8a5fef91
FANTASTIC work, thank you!
However, I find it a bit surprising (confusing, really) that
'C-c C-x R' and 'C-c C-x L'
do not promote/demote the selected subtrees, despite being documented as
"Demote subtree or insert table column."
and then
'C-c C-x r' and 'C-c C-x l'
do promote/demote selected subtrees despite being documented as
"Demote heading, list item at point or move table column right."
I immediately reached for the subtree manipulation commands, but they did not
work on the marked subtrees. Confused, I tried the headline manipulation
commands, and they did work ... on the marked subtrees.
Rudy
--
"Mathematics takes us still further from what is human into the region
of absolute necessity, to which not only the actual world, but every
possible world, must conform."
-- Bertrand Russell, 1902
Rudolf Adamkovič <salutis@me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 0/4] Structure editing when region is active
2023-02-06 21:00 ` Rudolf Adamkovič
@ 2023-02-07 10:56 ` Ihor Radchenko
2023-02-15 18:36 ` Rudolf Adamkovič
0 siblings, 1 reply; 20+ messages in thread
From: Ihor Radchenko @ 2023-02-07 10:56 UTC (permalink / raw)
To: Rudolf Adamkovič; +Cc: emacs-orgmode
Rudolf Adamkovič <salutis@me.com> writes:
> However, I find it a bit surprising (confusing, really) that
>
> 'C-c C-x R' and 'C-c C-x L'
[ for context, these are `org-shiftmetaright' and `org-shiftmetaleft'
> do not promote/demote the selected subtrees, despite being documented as
>
> "Demote subtree or insert table column."
They indeed do not. Only on selected list items. Patches welcome!
> and then
>
> 'C-c C-x r' and 'C-c C-x l'
>
> do promote/demote selected subtrees despite being documented as
>
> "Demote heading, list item at point or move table column right."
>
> I immediately reached for the subtree manipulation commands, but they did not
> work on the marked subtrees. Confused, I tried the headline manipulation
> commands, and they did work ... on the marked subtrees.
C-<Right>/<Left>/<Up>/<Down> do work on selected headings.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 0/4] Structure editing when region is active
2023-02-07 10:56 ` Ihor Radchenko
@ 2023-02-15 18:36 ` Rudolf Adamkovič
2023-02-15 20:35 ` Ihor Radchenko
0 siblings, 1 reply; 20+ messages in thread
From: Rudolf Adamkovič @ 2023-02-15 18:36 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
Ihor Radchenko <yantar92@posteo.net> writes:
> They indeed do not. Only on selected list items. Patches welcome!
Oh, wait I see. Non-recursive manipulation (l/r) works with marked regions but
recursive manipulation (L/R) does not work yet. Then, it all behaves correctly
and "patches welcome" makes sense (to make it work in both cases). Gotcha!
P.S. It took me a while to get all this because I do not use (nor have, for that
matter) arrow keys, and those nonsensical function names mean absolutely nothing
to me.
Rudy
--
"Chop your own wood and it will warm you twice."
-- Henry Ford; Francis Kinloch, 1819; Henry David Thoreau, 1854
Rudolf Adamkovič <salutis@me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 0/4] Structure editing when region is active
2023-02-15 18:36 ` Rudolf Adamkovič
@ 2023-02-15 20:35 ` Ihor Radchenko
2023-02-18 21:18 ` Philipp Kiefer
0 siblings, 1 reply; 20+ messages in thread
From: Ihor Radchenko @ 2023-02-15 20:35 UTC (permalink / raw)
To: Rudolf Adamkovič; +Cc: emacs-orgmode
Rudolf Adamkovič <salutis@me.com> writes:
> P.S. It took me a while to get all this because I do not use (nor have, for that
> matter) arrow keys, and those nonsensical function names mean absolutely nothing
> to me.
If you have ideas about good alternative names for these functions,
please share them.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 0/4] Structure editing when region is active
2023-02-15 20:35 ` Ihor Radchenko
@ 2023-02-18 21:18 ` Philipp Kiefer
2023-04-02 14:19 ` Ihor Radchenko
0 siblings, 1 reply; 20+ messages in thread
From: Philipp Kiefer @ 2023-02-18 21:18 UTC (permalink / raw)
To: yantar92; +Cc: emacs-orgmode, salutis
[-- Attachment #1.1: Type: text/plain, Size: 480 bytes --]
There is a bug here, where moving a region of several headings down,
then up will snag another heading onto the bottom of the region. See the
screencast for illustration. To reproduce, in the sample file use Alt-h
twich to select the headings 'Select 1' and 'Select 2' together in a
region, then press Alt-Down to move them just above the following
non-blank heading and then press Alt-Up. That heading will be dragged
along upward with the active region.
Thanks!
Philipp
[-- Attachment #1.2: Type: text/html, Size: 875 bytes --]
[-- Attachment #2: test.org --]
[-- Type: text/plain, Size: 990 bytes --]
*
* Select 1
* Select 2
*
* ~BE-AG-Fr, 17.02.23~
** noch letzte zwei: Gruppenpräsentationen fertig "Future of Work: The Next Generation | Houston PBS" (ganze Serie auf USB-Stick oder Youtube)
**
** ▉W fertig lesen: [[d:\Materialien und Texte - Englisch\Business English\Manners_politeness_behaviour in the workplace\Acceptable and Unacceptable Behaviour.docx]]
**
** Stop from time to time to compare notes:
** "The Future of Work: A VICE News Special Report - YouTube" https://www.youtube.com/watch?v=_iaKHeCKcq4
**
** cf. Moodle:
** ▉W [[d:\Materialien und Texte - Englisch\Business English\AB basic income 3-15.doc]]
** ▉W [[d:\Materialien und Texte - Englisch\Business English\basic income pro-con 15.doc]]
* ~BE-AG-Fr, 17.03.23~
* ~BE-AG-Fr, 24.02.23~
** Stop from time to time to compare notes:
** "Work on Trial | A Film by The Predictive Index - YouTube" https://www.youtube.com/watch?v=SEA_C6gAvok
* ~BE-AG-Fr, 24.03.23~
* ~BE-AG-Fr, 31.03.23~
*
[-- Attachment #3: StructEdActReg-bug.mp4 --]
[-- Type: video/mp4, Size: 256761 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 0/4] Structure editing when region is active
2023-02-18 21:18 ` Philipp Kiefer
@ 2023-04-02 14:19 ` Ihor Radchenko
0 siblings, 0 replies; 20+ messages in thread
From: Ihor Radchenko @ 2023-04-02 14:19 UTC (permalink / raw)
To: Philipp Kiefer; +Cc: emacs-orgmode, salutis
Philipp Kiefer <phil.kiefer@gmail.com> writes:
> There is a bug here, where moving a region of several headings down,
> then up will snag another heading onto the bottom of the region. See the
> screencast for illustration. To reproduce, in the sample file use Alt-h
> twich to select the headings 'Select 1' and 'Select 2' together in a
> region, then press Alt-Down to move them just above the following
> non-blank heading and then press Alt-Up. That heading will be dragged
> along upward with the active region.
Thanks for reporting!
Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=6f742685d
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2023-04-02 14:18 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-15 12:31 [PATCH 0/4] Structure editing when region is active Ihor Radchenko
2023-01-15 12:31 ` [PATCH 1/4] Preserve active region after structure edits Ihor Radchenko
2023-01-15 12:31 ` [PATCH 2/4] Preserve active region when toggling heading state Ihor Radchenko
2023-01-15 12:31 ` [PATCH 3/4] org-metaup, org-metadown: Move subtrees in active region Ihor Radchenko
2023-01-15 12:31 ` [PATCH 4/4] org-manual.org: Document changes in 8f6fcd709, 5719a8163, and eda9909a9 Ihor Radchenko
2023-01-16 0:24 ` [PATCH 0/4] Structure editing when region is active Samuel Wales
2023-01-16 11:17 ` Ihor Radchenko
2023-01-17 1:45 ` Samuel Wales
2023-01-17 9:46 ` Ihor Radchenko
2023-01-18 1:11 ` Samuel Wales
2023-01-18 10:14 ` Ihor Radchenko
2023-02-04 22:45 ` Samuel Wales
2023-02-05 11:11 ` Ihor Radchenko
2023-02-04 13:54 ` Ihor Radchenko
2023-02-06 21:00 ` Rudolf Adamkovič
2023-02-07 10:56 ` Ihor Radchenko
2023-02-15 18:36 ` Rudolf Adamkovič
2023-02-15 20:35 ` Ihor Radchenko
2023-02-18 21:18 ` Philipp Kiefer
2023-04-02 14:19 ` Ihor Radchenko
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.