Does this do what you want?
(defun clone-subtree ()
"Clone the current subtree and change the id."
(interactive)
(when (not (looking-at "^\\*"))
(re-search-backward "^\\*"))
(org-copy-subtree)
(goto-char (org-element-property :end (org-element-context)))
(org-paste-subtree)
(org-id-get-create t))
Xebar Saram writes:
> ok so i have this so far
>
>
> (defun zxx ()
> "duplicate and change id of org header"
> (interactive)
> (org-copy-subtree)
> (org-end-of-line)
> (newline)
> ;(org-yank)
> (org-paste-subtree)
> (org-forward-heading-same-level 1)
> (let ((current-prefix-arg '(4)))
> (call-interactively #'org-id-get-create))
> )
>
>
> yet it seems very bloated since i cant code ;-) and dosent work as it
> dosent really creates a new org-id. any tips?
>
> best
>
> Z
>
>
> On Wed, Aug 3, 2016 at 7:17 AM, Xebar Saram <[email protected]> wrote:
>
>> 1. copy current header and contents (org-copy-subtree) at point
>> 2. auto paste it below current header
>> 3. change ID
>>
--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu