all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* org-clone-subtree-with-time-shift with reverse order
@ 2024-04-10 20:10 Christian Barthel
  2024-04-11 14:07 ` Ihor Radchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Barthel @ 2024-04-10 20:10 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 257 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org.el-prepend.patch --]
[-- Type: text/x-diff, Size: 1443 bytes --]

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-14 13:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-10 20:10 org-clone-subtree-with-time-shift with reverse order Christian Barthel
2024-04-11 14:07 ` Ihor Radchenko
2024-04-14  8:59   ` Christian Barthel
2024-04-14 13:17     ` 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.