From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Bauer Subject: Re: Automatic tangling/detangling Date: Sat, 3 Mar 2018 15:50:09 -0600 Message-ID: References: <27AF096F-3FFC-47E1-85F0-77FA9361F33A@zzamboni.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45428) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esF31-0003Zw-Eq for emacs-orgmode@gnu.org; Sat, 03 Mar 2018 16:50:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esF30-0007Zj-AI for emacs-orgmode@gnu.org; Sat, 03 Mar 2018 16:50:31 -0500 Received: from mail-it0-x234.google.com ([2607:f8b0:4001:c0b::234]:54452) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esF30-0007YN-4p for emacs-orgmode@gnu.org; Sat, 03 Mar 2018 16:50:30 -0500 Received: by mail-it0-x234.google.com with SMTP id c11so5429124ith.4 for ; Sat, 03 Mar 2018 13:50:29 -0800 (PST) In-Reply-To: <27AF096F-3FFC-47E1-85F0-77FA9361F33A@zzamboni.org> 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: Diego Zamboni Cc: emacs-orgmode@gnu.org Yes, detangling works okay for me. I just setup properties like this: * Emacs Init file :PROPERTIES: :header-args: :tangle yes :comments link :END: ...etc. And you can open the generated file and run "org-babel-detangle" when you are done editing it. I guess I'm interesting in finding some "smarter" ways to do this. Using 'append' might work better than what I have. I'm also looking in to doing some sort of "async" usage (using some checks so multiple tangles don't run at once). I wonder if there's an easy way to setup "locks" in Emacs so you can only edit one file at a time (kind of like how auto revert works). Still researching all of this. On Sat, Mar 3, 2018 at 10:47 AM, Diego Zamboni wrote: > Hi Matthew, > > How do you do the untangling? I have been using an after-hook call to > org-babel-tangle, which works quite well. It is a bit slow for large file= s > with many code segments (like my Emacs init file at > https://github.com/zzamboni/dot-emacs/blob/master/init.org), and it requi= res > a bit of discipline for editing only the org file and not the output file= , > but works well otherwise. I have never tried to de-tangle, that would > require some markers in the output file I guess? > > Here=E2=80=99s the code I use at the moment I am super happy with it, as = it prevents > my output files to get out of sync from the org file: > > (add-hook 'org-mode-hook > (lambda () (add-hook 'after-save-hook 'org-babel-tangle > 'run-at-end 'only-in-org-mode))) > > > Best, > =E2=80=94Diego > > On 3 Mar 2018, at 04:38, Matthew Bauer wrote: > > Is there any good way to automatically tangle Org files and detangle tang= led > files? I frequently use this workflow but they often get out of sync. I h= ave > tried adding an after-save-hook but it=E2=80=99s too slow to be useful. S= omething > like auto revert mode might work better... > > Anyone have solutions for this? > > -Matthew Bauer > >