I'd like to suggest adding a new prefix arg i.e.
`C-u C-u org-clone-subtree-with-item-shift' to reverse
the order of newly created / cloned siblings. Would
that be of interest for other orgmode users?
Diff file is attached.
--
Christian Barthel
diff -u --label \#\<buffer\ org.el.gz\> --label \#\<buffer\ org.el\> /tmp/buffer-content-gd7Tiz /tmp/buffer-content-QbeeNi
--- #<buffer org.el.gz>
+++ #<buffer org.el>
@@ -7342,7 +7342,11 @@
As described above, N+1 clones are produced when the original
subtree has a repeater. Setting N to 0, then, can be used to
remove the repeater from a subtree and create a shifted clone
-with the original repeater."
+with the original repeater.
+
+The new siblings will normally be appended. When using `C-u C-u'
+prefix argument, the siblings will be prepended.
+"
(interactive "nNumber of clones to produce: ")
(unless (wholenump n) (user-error "Invalid number of replications %s" n))
(when (org-before-first-heading-p) (user-error "No subtree to clone"))
@@ -7388,7 +7392,7 @@
(setq nmin 0)
(setq nmax (1+ nmax))
(setq n-no-remove nmax))
- (goto-char end)
+ (goto-char (if (equal current-prefix-arg '(16)) beg end))
(cl-loop for n from nmin to nmax do
(insert
;; Prepare clone.
@@ -7418,7 +7422,8 @@
(goto-char (match-beginning 0))
(when (looking-at "<[^<>\n]+\\( +[.+]?\\+[0-9]+[hdwmy]\\)")
(delete-region (match-beginning 1) (match-end 1)))))))
- (buffer-string)))))
+ (buffer-string)))
+ (if (equal current-prefix-arg '(16)) (goto-char beg))))
(goto-char beg)))
;;; Outline path
Diff finished. Wed Apr 10 11:42:21 2024