From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: function to duplicate current header and change ID Date: Thu, 11 Aug 2016 11:33:37 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59483) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXrzM-0004LA-Fg for emacs-orgmode@gnu.org; Thu, 11 Aug 2016 11:33:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXrzI-0008Ts-MQ for emacs-orgmode@gnu.org; Thu, 11 Aug 2016 11:33:43 -0400 Received: from mail-io0-x229.google.com ([2607:f8b0:4001:c06::229]:34680) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXrzI-0008Th-I4 for emacs-orgmode@gnu.org; Thu, 11 Aug 2016 11:33:40 -0400 Received: by mail-io0-x229.google.com with SMTP id q83so9555445iod.1 for ; Thu, 11 Aug 2016 08:33:40 -0700 (PDT) In-reply-to: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" 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 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