emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Florian Adamsky <fa-orgmode@haktar.org>
To: emacs-orgmode@gnu.org
Cc: Eric Abrahamsen <eric@ericabrahamsen.net>
Subject: Re: Archive subtrees hierarchical (keep the parent structure)
Date: Tue, 05 Aug 2014 13:08:38 +0200	[thread overview]
Message-ID: <877g2n19e1.fsf@voyager.localdomain> (raw)
In-Reply-To: <87k36n4s54.fsf@ericabrahamsen.net>

Dear Eric,

On Tuesday, Aug 05 2014, Eric Abrahamsen <eric@ericabrahamsen.net> wrote:

> Thanks for this work -- I think this is a nice feature. One concern
> about the above is that, if you're archiving many FOOs, then you'll get
> a whole bunch of duplicate A/B parent structures. There are several
> places in my agenda files where I have the exact structure in your
> example, and a *whole* lot of FOOs going in and getting archived out.
> How hard would it be to look for an existing A/B parent structure in the
> archive file, and put FOO there if it's found? Not a perfect solution,
> since you might have more than one A/B, but seems like it would help in
> a majority of cases...

if I understand you correctly, then I have already implemented that. If
I would like to archive "*** Foo", the function (fa/org-struct-subtree)
returns the parent headings as a list, e.g. ("*A " "** B"). Inside the
archive file, I search for "* A" and inside that heading I search for
"** B". If "** B" was not found, it inserts the remaining list that was
not found and does not create a new "* A" again. This means if you have
"*A " and "** B" already in your archive file it will not add a new A/B.

A problem exists if you have the exact same structure twice in one file like
the following example:

* A
** B
*** FOO

* A
** B
*** FOO

If you would archive both *** FOO, then the archive file would look like
this:

* A
** B
*** FOO
*** FOO

In order to fix that problem we need a unique id for every heading. My
current implementation implies that at least the first heading is
unique. Then it should not be a problem.

Best regards
--
Florian Adamsky
http://florian.adamsky.it/

  reply	other threads:[~2014-08-05 11:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-04 19:29 Archive subtrees hierarchical (keep the parent structure) Florian Adamsky
2014-08-05  1:55 ` Eric Abrahamsen
2014-08-05 11:08   ` Florian Adamsky [this message]
2014-08-05 11:23     ` Eric Abrahamsen
2014-08-05 12:25 ` Ken Mankoff
2014-08-05 15:32   ` Florian Adamsky
2014-08-05 16:39     ` Ken Mankoff
2014-08-05 17:46       ` Florian Adamsky
2014-08-05 18:00         ` Ken Mankoff
2014-11-04 17:03           ` Dylan Schwilk

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=877g2n19e1.fsf@voyager.localdomain \
    --to=fa-orgmode@haktar.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=eric@ericabrahamsen.net \
    /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).