emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Lundin <mdl@imapmail.org>
To: "Pere Quintana Seguí" <pquintana@obsebre.es>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: Merging .org files
Date: Sun, 30 Jan 2011 16:51:02 -0500	[thread overview]
Message-ID: <8739oadprt.fsf@fastmail.fm> (raw)
In-Reply-To: 4D454DF7.8020907@obsebre.es

Pere Quintana Seguí <pquintana@obsebre.es> 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

  parent reply	other threads:[~2011-01-30 21:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-30 11:39 Merging .org files Pere Quintana Seguí
2011-01-30 17:39 ` Juan Pechiar
2011-01-30 22:09   ` Pere Quintana Seguí
2011-01-30 19:22 ` Michael Welle
2011-01-30 22:20   ` Pere Quintana Seguí
2011-01-30 21:51 ` Matt Lundin [this message]
2011-01-31 15:18   ` Pere Quintana Seguí
2011-01-31 20:45     ` Michael Welle
2011-02-07  8:28       ` Pere Quintana Seguí
2011-03-18 20:38         ` Matt Lundin
2011-03-19  8:51           ` Aankhen
2011-03-19 12:53             ` Matt Lundin
2011-03-19 17:42               ` Aankhen

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=8739oadprt.fsf@fastmail.fm \
    --to=mdl@imapmail.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=pquintana@obsebre.es \
    /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).