From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id wLUwO3nN014xKQAA0tVLHw (envelope-from ) for ; Sun, 31 May 2020 15:30:01 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id qP0TN3nN014JOwAAB5/wlQ (envelope-from ) for ; Sun, 31 May 2020 15:30:01 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 7DE8F940A38 for ; Sun, 31 May 2020 15:30:00 +0000 (UTC) Received: from localhost ([::1]:53736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jfPuP-00061t-VF for larch@yhetil.org; Sun, 31 May 2020 11:29:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48922) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfPu3-00061d-Pd for emacs-orgmode@gnu.org; Sun, 31 May 2020 11:29:35 -0400 Received: from mail-qk1-x731.google.com ([2607:f8b0:4864:20::731]:35716) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jfPu2-00089X-CZ for emacs-orgmode@gnu.org; Sun, 31 May 2020 11:29:35 -0400 Received: by mail-qk1-x731.google.com with SMTP id n141so6869044qke.2 for ; Sun, 31 May 2020 08:29:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:references:user-agent:from:to:cc:subject:in-reply-to :message-id:date:mime-version; bh=oWfoDtuCs0ef7ADoI/9dEbDmpmxm44Ut+xaNjP+DTe0=; b=JhIz7kXzQbEiBErKKrpecHnWjfQdTz554uUhQo5hsx5nXyBUie4gp6wz48OQp+LNft OiEoGuBGlhagN4zPHBWnHrxc4UvmxXg+H7JgjAZ/rflNAsmtjhHrKLAkR+ftVkcLANPO Vs9+0npMZo8lG7ycEwCRak99SLefXNrNmw5hxDZ1sbOR0mgu1BTXwJWP7uNi4RzMCDdj /fWdHDhD5T5SCkU/BXqAlJ01Jiszd0eRxCbAPPO3PH4xMeS756QLSvvyQAg5lozWCX1s nAyvj0HHtJQvDZLoRO9LdL/PpZn8Y0TMHZ7Iiy8JVucRwDk2jxj1dVoI3fUDbqWzjhnH 6FoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:references:user-agent:from:to:cc:subject :in-reply-to:message-id:date:mime-version; bh=oWfoDtuCs0ef7ADoI/9dEbDmpmxm44Ut+xaNjP+DTe0=; b=CrQtJmGU/vCnQTd5qJRlIJLMEaFfn3TTfXUsKNdl9+PDHpt59ciqRXDX6/QFQMoOA6 VwgRoTtWy3I5gUB7UsaGIY61mo5z5rR864qUy3APXZrIuubz1RIrKji6Ej8Q/OfdE/6w PVZ51U933gx2tJD9T/+bviUfsQcxw4tMP82MffSymxlbnpQwgR3+/Ur6x9ct8aGVU4bM D2BoSb5qScHE0kynfGBkHHP1sJsGJb6uOpKuKh1NGXct1K8EsqA5Aylz5hagDtWsOrQT KRcFU+50mDNSopLVJl1mOONJTCsIO3/ljLDoQTVIZlny4AJkUMEokq2m8Wm2jcQjFE2k eWxA== X-Gm-Message-State: AOAM533Yh5Fy5cRcZ3sDxAyVBo840FaLsEpRxvEI0XKoPGpCJAmQr08K k3/OXVUJ9BJ6ouvkI4S9wxwVb85rERg= X-Google-Smtp-Source: ABdhPJxztd/kSf0gUgcF7NoqCcYY+LDGO5VfeyLJqeZaIti/WPuoAYXBeSgCwP7/wSCM7t4ss/hQcQ== X-Received: by 2002:a37:588:: with SMTP id 130mr1284844qkf.209.1590938972472; Sun, 31 May 2020 08:29:32 -0700 (PDT) Received: from Johns-MacBook-Air.local ([2601:547:901:1830:6127:22cb:c9a9:11d8]) by smtp.gmail.com with ESMTPSA id l2sm11573999qkd.57.2020.05.31.08.29.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 31 May 2020 08:29:31 -0700 (PDT) References: <64119DDD-42BD-47AC-9EB6-DD25FE58BB37@ur.rochester.edu> User-agent: mu4e 1.3.6; emacs 26.3 From: John Kitchin To: emacs-orgmode@gnu.org Cc: Subject: Re: Splitting large org file into smaller ones In-reply-to: <64119DDD-42BD-47AC-9EB6-DD25FE58BB37@ur.rochester.edu> Message-ID: Date: Sun, 31 May 2020 11:29:29 -0400 MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::731; envelope-from=johnrkitchin@gmail.com; helo=mail-qk1-x731.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=JhIz7kXz; dmarc=fail reason="SPF not aligned (relaxed)" header.from=andrew.cmu.edu (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: 1.59 X-TUID: P5MVyxcz5n4K This seems like an important thing to get right, so I would hesitate to do this very automatically. I would write a function that does what you want, maybe like this: #+BEGIN_SRC emacs-lisp (defun subtree-to-file () (interactive) (org-narrow-to-subtree) (goto-char (point-min)) (let* ((heading (fifth (org-heading-components))) (fname (concat (mapconcat 'downcase (split-string heading) "-") ".org"))) (when (y-or-n-p (format "Write subtree to %s" fname)) (org-cut-subtree) (with-temp-file fname (org-yank)))) (widen) (when (not (org-at-heading-p)) (org-next-visible-heading 1))) #+END_SRC This will generate filenames based on the heading name, and move the content to that file if you agree with the filename. It does not check if the fname exists, which may be a good idea. It does not do anything fancy like promote the heading, it just moves it. It is a good idea to do this on a copy of the original file, so that you have an un-altered version in case it does not go as planned. Marvin M. Doyley writes: > Hi there, > > Is there an efficient way to split a large org file into smaller ones? > > Lets say I have a master file with the following > > > * Notes > ** Candidate A > - Strong technical background > - High H-factor > - good funding > - More established investigator > - Huge startup need $$ > > ** Candidate B > - lower startup need > - signal processing > - young investigator > > > How do I export the subtree to separate org files, say > > - Candidate-a.org > - Candidate-b.org > > > Thanks > > M -- 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