emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Automatic tangling/detangling
@ 2018-03-03  3:38 Matthew Bauer
  2018-03-03 16:47 ` Diego Zamboni
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Bauer @ 2018-03-03  3:38 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Automatic tangling/detangling
  2018-03-03  3:38 Automatic tangling/detangling Matthew Bauer
@ 2018-03-03 16:47 ` Diego Zamboni
  2018-03-03 21:50   ` Matthew Bauer
  0 siblings, 1 reply; 4+ messages in thread
From: Diego Zamboni @ 2018-03-03 16:47 UTC (permalink / raw)
  To: Matthew Bauer; +Cc: Diego Zamboni, emacs-orgmode

[-- 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 --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Automatic tangling/detangling
  2018-03-03 16:47 ` Diego Zamboni
@ 2018-03-03 21:50   ` Matthew Bauer
  2018-03-03 22:53     ` Diego Zamboni
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Bauer @ 2018-03-03 21:50 UTC (permalink / raw)
  To: Diego Zamboni; +Cc: emacs-orgmode

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
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Automatic tangling/detangling
  2018-03-03 21:50   ` Matthew Bauer
@ 2018-03-03 22:53     ` Diego Zamboni
  0 siblings, 0 replies; 4+ messages in thread
From: Diego Zamboni @ 2018-03-03 22:53 UTC (permalink / raw)
  To: Matthew Bauer; +Cc: Diego Zamboni, emacs-orgmode

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
>> 
>> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-03-03 22:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

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).