* 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
* Re: org-clone-subtree-with-time-shift with reverse order
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
0 siblings, 1 reply; 4+ messages in thread
From: Ihor Radchenko @ 2024-04-11 14:07 UTC (permalink / raw)
To: Christian Barthel; +Cc: emacs-orgmode
Christian Barthel <bch@online.de> writes:
> 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?
May you explain your use case a bit more?
--
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] 4+ messages in thread
* Re: org-clone-subtree-with-time-shift with reverse order
2024-04-11 14:07 ` Ihor Radchenko
@ 2024-04-14 8:59 ` Christian Barthel
2024-04-14 13:17 ` Ihor Radchenko
0 siblings, 1 reply; 4+ messages in thread
From: Christian Barthel @ 2024-04-14 8:59 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
On Thursday, April 11, 2024, Ihor Radchenko wrote:
> Christian Barthel <bch@online.de> writes:
>
>> 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?
>
> May you explain your use case a bit more?
The reason: I often use the
`org-tree-to-indirect-buffer'. But when adding a new
sub-node with org-capture, it often was not shown
inside this indirect buffer. Therefore, I prepended
all items with org-capture (:prepend t). To intermix
this capturing process with the
org-clone-subtree-with-time-shift, it would have been
nice to specify the ordering.
*However* - this seems to be working with Emacs 29.3(?).
(I updated my Emacs to verify the current situation).
So I guess, this is actually no longer necessary
for my workflow and I can set :prepend to `nil'
On the other hand: There are ways to specify the
ordering like org-reverse-note-order. Would it make
sense to have one global `org-reverse-order' that is
dealing with reversing "everything" that is somehow
dependent on ordering?
--
Christian Barthel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: org-clone-subtree-with-time-shift with reverse order
2024-04-14 8:59 ` Christian Barthel
@ 2024-04-14 13:17 ` Ihor Radchenko
0 siblings, 0 replies; 4+ messages in thread
From: Ihor Radchenko @ 2024-04-14 13:17 UTC (permalink / raw)
To: Christian Barthel; +Cc: emacs-orgmode
Christian Barthel <bch@online.de> writes:
> On the other hand: There are ways to specify the
> ordering like org-reverse-note-order. Would it make
> sense to have one global `org-reverse-order' that is
> dealing with reversing "everything" that is somehow
> dependent on ordering?
The problem is that it is not very clear what to do when:
org-clone-subtree-with-time-shift docstring:
If the original subtree did contain time stamps with a repeater,
the following will happen:
...
- the original entry will be placed *after* all the clones, with
repeater intact.
So, the change is not trivial.
--
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] 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 public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).