emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] function to duplicate current header and change ID


From: John Kitchin
Subject: Re: [O] function to duplicate current header and change ID
Date: Thu, 11 Aug 2016 11:33:37 -0400
User-agent: mu4e 0.9.16; emacs 25.1.50.1

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 <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]