emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Diego Zamboni <diego@zzamboni.org>
To: Matthew Bauer <mjbauer95@gmail.com>
Cc: Diego Zamboni <diego@zzamboni.org>, emacs-orgmode@gnu.org
Subject: Re: Automatic tangling/detangling
Date: Sat, 3 Mar 2018 17:47:56 +0100	[thread overview]
Message-ID: <27AF096F-3FFC-47E1-85F0-77FA9361F33A@zzamboni.org> (raw)
In-Reply-To: <E6340386-86ED-4104-96FF-D289362B4FB5@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1276 bytes --]

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 <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’s 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,
—Diego

> 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’s too slow to be useful. Something like auto revert mode might work better...
> 
> Anyone have solutions for this?
> 
> -Matthew Bauer


[-- Attachment #2: Type: text/html, Size: 3204 bytes --]

  reply	other threads:[~2018-03-03 16:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-03  3:38 Automatic tangling/detangling Matthew Bauer
2018-03-03 16:47 ` Diego Zamboni [this message]
2018-03-03 21:50   ` Matthew Bauer
2018-03-03 22:53     ` Diego Zamboni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=27AF096F-3FFC-47E1-85F0-77FA9361F33A@zzamboni.org \
    --to=diego@zzamboni.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=mjbauer95@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).