emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] Re: Merging .org files


From: Matt Lundin
Subject: [Orgmode] Re: Merging .org files
Date: Sun, 30 Jan 2011 16:51:02 -0500
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux)

Pere Quintana Seguí <address@hidden> writes:

> In my current system, I have about 200 .org files. With this number of
> files, building the agenda is very slow in my home computer and, also,
> makes the performance of MobileOrg quite poor.
>
> So, I would like to join files, to increase the system's performance.

FWIW, I've found the opposite to be true. Splitting up larger files and
reducing the depth of the hierarchy marginally improves agenda
performance (~ 0.2 seconds acc. to elp). But in my case, I split 10
files into 40, so I have no idea what 200 files would do. Perhaps
there's a sweet spot somewhere? I also haven't used mobile org.

In my experience, archiving old items and reducing the number of active
todos is the best way to keep the agenda snappy.

> Is there any script to cleanly join files, by transforming the title of
> the file in a first level heading (*) and adding an star to all other
> headings of the file?

Perl is always handy for this type of thing:

--8<---------------cut here---------------start------------->8---
#!/usr/bin/perl
use strict;
use warnings;

my $mergefile = "/tmp/merged.org";

open NEWFILE, ">", $mergefile 
  or die "Can't open $mergefile: $!";

while (<>) {
  s/^(\*+)/*$1/;
  s/^#\+TITLE:\s+(.*)$/* $1/;
  s/^(#\+\w+:.*)$/: $1/;
  print NEWFILE "$_";
}

close NEWFILE;
--8<---------------cut here---------------end--------------->8---

Note: This is a quick proof of concept. Use at your own risk. ;)

Best,
Matt



reply via email to

[Prev in Thread] Current Thread [Next in Thread]