From mboxrd@z Thu Jan 1 00:00:00 1970 From: Diego Zamboni Subject: Re: Automatic tangling/detangling Date: Sat, 3 Mar 2018 17:47:56 +0100 Message-ID: <27AF096F-3FFC-47E1-85F0-77FA9361F33A@zzamboni.org> References: Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_3C2EC819-2CAE-4766-A978-651E1EF4C972" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esAKK-0001tx-O5 for emacs-orgmode@gnu.org; Sat, 03 Mar 2018 11:48:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esAKG-0002Ah-HT for emacs-orgmode@gnu.org; Sat, 03 Mar 2018 11:48:04 -0500 Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]:52113) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esAKG-00029E-73 for emacs-orgmode@gnu.org; Sat, 03 Mar 2018 11:48:00 -0500 Received: by mail-wm0-x22d.google.com with SMTP id h21so8472158wmd.1 for ; Sat, 03 Mar 2018 08:48:00 -0800 (PST) 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: Matthew Bauer Cc: Diego Zamboni , emacs-orgmode@gnu.org --Apple-Mail=_3C2EC819-2CAE-4766-A978-651E1EF4C972 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 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 = files with many code segments (like my Emacs init file at = https://github.com/zzamboni/dot-emacs/blob/master/init.org = ), and it = requires 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: >=20 > Is there any good way to automatically tangle Org files and detangle = tangled files? I frequently use this workflow but they often get out of = sync. I have tried adding an after-save-hook but it=E2=80=99s too slow = to be useful. Something like auto revert mode might work better... >=20 > Anyone have solutions for this? >=20 > -Matthew Bauer --Apple-Mail=_3C2EC819-2CAE-4766-A978-651E1EF4C972 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 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 = files with many code segments (like my Emacs init file at https://github.com/zzamboni/dot-emacs/blob/master/init.org)= , and it requires 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 <mjbauer95@gmail.com> wrote:

Is = there any good way to automatically tangle Org files and detangle = tangled files? I frequently use this workflow but they often get out of = sync. I have tried adding an after-save-hook but it=E2=80=99s too slow = to be useful. Something like auto revert mode might work better...

Anyone have solutions for this?

-Matthew Bauer

= --Apple-Mail=_3C2EC819-2CAE-4766-A978-651E1EF4C972--