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 23:53:31 +0100	[thread overview]
Message-ID: <298CD440-5F4F-4C5B-942E-D02D1248B818@zzamboni.org> (raw)
In-Reply-To: <CAFnZKr3rLzJKhuKQhOysyubeC9CNfhNyEccS2Luw_MX4D3V=ag@mail.gmail.com>

Interesting! I didn’t know about org-babel-detangle. I’d be very interested in what you come up with. I’ll try to do some exploration on my own as well.

Best,
—Diego

> On 3 Mar 2018, at 22:50, Matthew Bauer <mjbauer95@gmail.com> wrote:
> 
> 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 <diego@zzamboni.org> 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 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’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
>> 
>> 

      reply	other threads:[~2018-03-03 22:53 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
2018-03-03 21:50   ` Matthew Bauer
2018-03-03 22:53     ` Diego Zamboni [this message]

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=298CD440-5F4F-4C5B-942E-D02D1248B818@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).