* function to duplicate current header and change ID
@ 2016-08-03 4:17 Xebar Saram
2016-08-11 11:22 ` Xebar Saram
0 siblings, 1 reply; 5+ messages in thread
From: Xebar Saram @ 2016-08-03 4:17 UTC (permalink / raw)
To: org mode
[-- Attachment #1: Type: text/plain, Size: 397 bytes --]
Hi all
i noticed i use the copy and then paste entire headers (with content) quite
often. the problem i also notice is that creates alot of issues with
duplicate IDS. I wonder if anyone has a function he would like to share or
can help me create a function that will
1. copy current header and contents (org-copy-subtree) at point
2. auto paste it below current header
3. change ID
thx alot!
Z
[-- Attachment #2: Type: text/html, Size: 523 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: function to duplicate current header and change ID
2016-08-03 4:17 function to duplicate current header and change ID Xebar Saram
@ 2016-08-11 11:22 ` Xebar Saram
2016-08-11 15:33 ` John Kitchin
0 siblings, 1 reply; 5+ messages in thread
From: Xebar Saram @ 2016-08-11 11:22 UTC (permalink / raw)
To: org mode
[-- Attachment #1: Type: text/plain, Size: 613 bytes --]
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 <zeltakc@gmail.com> wrote:
> 1. copy current header and contents (org-copy-subtree) at point
> 2. auto paste it below current header
> 3. change ID
>
[-- Attachment #2: Type: text/html, Size: 1607 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: function to duplicate current header and change ID
2016-08-11 11:22 ` Xebar Saram
@ 2016-08-11 15:33 ` John Kitchin
2016-08-11 17:16 ` Xebar Saram
0 siblings, 1 reply; 5+ messages in thread
From: John Kitchin @ 2016-08-11 15:33 UTC (permalink / raw)
To: Xebar Saram; +Cc: org mode
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 <zeltakc@gmail.com> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: function to duplicate current header and change ID
@ 2016-08-17 12:10 Jorge
0 siblings, 0 replies; 5+ messages in thread
From: Jorge @ 2016-08-17 12:10 UTC (permalink / raw)
To: John Kitchin; +Cc: Xebar Saram, org mode
On 11 August 2016 at 12:33, John Kitchin <jkitchin@andrew.cmu.edu> wrote:
> Does this do what you want?
Could not he just use C-u C-c C-x c (org-clone-subtree-with-time-shift)?
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-08-17 12:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-03 4:17 function to duplicate current header and change ID Xebar Saram
2016-08-11 11:22 ` Xebar Saram
2016-08-11 15:33 ` John Kitchin
2016-08-11 17:16 ` Xebar Saram
-- strict thread matches above, loose matches on Subject: below --
2016-08-17 12:10 Jorge
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).