emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* possible misfeature regarding multiple #+ARCHIVE lines in a file
@ 2007-09-01 21:51 Brian van den Broek
  2007-09-01 22:05 ` Brian van den Broek
  0 siblings, 1 reply; 7+ messages in thread
From: Brian van den Broek @ 2007-09-01 21:51 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

I'm still getting the hang of org-mode, so the problem might be me :-)

That said, there seems to be a misfeature in the way org-mode archives 
subtrees when using multiple #+ARCHIVE lines in one file.

Consider an org file _testofarchive.org that looks like:


#+ARCHIVE: ./_testofarchiveARCHIVE.org::* First
* First 2007

#+ARCHIVE: ./_testofarchiveARCHIVE.org::* Second
* Second 2007

#+ARCHIVE: ./_testofarchiveARCHIVE.org::* Third
* Third 2007


With point on the * Second 2007 headline, invoke C-c C-x C-s. After 
the archiving, the file looks like


#+ARCHIVE: ./_testofarchiveARCHIVE.org::* First
* First 2007

#+ARCHIVE: ./_testofarchiveARCHIVE.org::* Second
* Third 2007


The problem is that the #+ARCHIVE line governing the * Second 2007 
headline is left behind, and the one governing the * Third 2007 
headline is taken away, not as desired. (What I would like to have 
happen is that the * Second 2007 tree gets filed away, and the 
following #+ARCHIVE line remains to affect future archiving of * Third 
2007.)

As I understand org-mode, this is a consequence of taking a subtree of 
level n to continue until a headline of level m, m <= n occurs or 
EOF. But, unless I am missing something, I don't see how the multiple 
#+ARCHIVE lines technique can be made to work with this definition, 
short of including dummy level 1 headlines in the file to `protect' 
the #+ARCHIVE lines. (I mean something like inserting

* To make org happy
#+ARCHIVE: ./_testofarchiveARCHIVE.org::* Third

between * Second 2007 and * Third 2007.)

Am I missing something about how these #+ARCHIVE lines are intended to 
be used?

It seems to me that a possible fix would be to look at the end of any 
subtree that is being archived, and leave behind an #+ARCHIVE line (or 
perhaps uninterrupted block of #+ lines) that terminates the tree 
being archived.

And, in case it seems like I am trying to do something daft, I'd like 
to explain my aim briefly. I have a file teaching.org. Each course for 
the coming term is a top-level headline with course name and term 
details (e.g., * Intro to Phil 20072008). As I teach some of the same 
courses in successive terms and academic years, I'd like my 
teachingARCHIVE.org file to have top level headings for each course 
title I teach and to send the archived subtrees of particular 
offerings of a given course title to the appropriate heading in my 
teachingARCHIVE.org. So, at the end of the year * Intro to Phil 
20072008 would become a second level heading under * Intro to Phil, 
and likewise for * Intro to Phil 20082009 should I teach that next year.

This isn't crucial (I can live without the archiving mechanism sorting 
the course subtrees for me). But, I can't see how to use the #+ARCHIVE 
lines as currently implemented.

Thanks and best,

Brian vdB

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

* Re: possible misfeature regarding multiple #+ARCHIVE lines in a file
  2007-09-01 21:51 possible misfeature regarding multiple #+ARCHIVE lines in a file Brian van den Broek
@ 2007-09-01 22:05 ` Brian van den Broek
  2007-09-03  7:30   ` Carsten Dominik
  0 siblings, 1 reply; 7+ messages in thread
From: Brian van den Broek @ 2007-09-01 22:05 UTC (permalink / raw)
  To: emacs-orgmode

Brian van den Broek said unto the world upon 09/01/2007 05:51 PM:

Hi all,

Sorry for the self-reply, but after posting I expanded the parameters 
of my google search, and thought a follow-up worthwhile.

I posted woes regarding #+ARCHIVE lines getting archived or left 
behind. And I suggested a dummy headline to ameliorate the problem:

> As I understand org-mode, this is a consequence of taking a subtree of 
> level n to continue until a headline of level m, m <= n occurs or EOF. 
> But, unless I am missing something, I don't see how the multiple 
> #+ARCHIVE lines technique can be made to work with this definition, 
> short of including dummy level 1 headlines in the file to `protect' the 
> #+ARCHIVE lines. (I mean something like inserting
> 
> * To make org happy
> #+ARCHIVE: ./_testofarchiveARCHIVE.org::* Third
> 
> between * Second 2007 and * Third 2007.)

In a thread from 2007-03 started by 
<http://lists.gnu.org/archive/html/emacs-orgmode/2007-03/msg00084.html>
a similar problem was discussed regarding #+CATEGORY lines. Carsten 
<http://lists.gnu.org/archive/html/emacs-orgmode/2007-03/msg00089.html> 
said that what I called `dummy' headlines was one of two possible 
work-arounds he could see. What didn't come up was the suggestion I made:

> It seems to me that a possible fix would be to look at the end of any 
> subtree that is being archived, and leave behind an #+ARCHIVE line (or 
> perhaps uninterrupted block of #+ lines) that terminates the tree being 
> archived.

Now I am curious as to if this is unworkable. Carsten, if it is, would 
you mind briefly sketching why? (Time permitting, of course.)

Thanks and best,

Brian vdB

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

* Re: possible misfeature regarding multiple #+ARCHIVE lines in a file
  2007-09-01 22:05 ` Brian van den Broek
@ 2007-09-03  7:30   ` Carsten Dominik
  2007-09-03 17:43     ` Brian van den Broek
  0 siblings, 1 reply; 7+ messages in thread
From: Carsten Dominik @ 2007-09-03  7:30 UTC (permalink / raw)
  To: Brian van den Broek; +Cc: emacs-orgmode


On Sep 2, 2007, at 0:05, Brian van den Broek wrote:

> Brian van den Broek said unto the world upon 09/01/2007 05:51 PM:
> In a thread from 2007-03 started by  
> <http://lists.gnu.org/archive/html/emacs-orgmode/2007-03/ 
> msg00084.html>
> a similar problem was discussed regarding #+CATEGORY lines. Carsten  
> <http://lists.gnu.org/archive/html/emacs-orgmode/2007-03/ 
> msg00089.html> said that what I called `dummy' headlines was one of  
> two possible work-arounds he could see. What didn't come up was the  
> suggestion I made:
>
>> It seems to me that a possible fix would be to look at the end of any  
>> subtree that is being archived, and leave behind an #+ARCHIVE line  
>> (or perhaps uninterrupted block of #+ lines) that terminates the tree  
>> being archived.
>
> Now I am curious as to if this is unworkable. Carsten, if it is, would  
> you mind briefly sketching why? (Time permitting, of course.)


Hi Brian,

In principle the solution you propose is workable of course.
You are, in fact, not the first to think of this: for example
the file outline.el in Emacs 22 states:

;;; Todo:

;; - subtree-terminators
;; - better handle comments before function bodies (i.e. heading)
;; - don't bother hiding whitespace

This is an issue in many types of files that would like to use
outline to get a structured view on a file.  For example
Programmers often write comments *before* a function definition.

I find it hard to envision a *clean* implementation, however.
Problems with this approach are:

- Lets say we say that comments before a headline so not belong
   to the entry before it.   Do they belong to the entry after it?
   If I archive the entry after it, should I move the comment then?

- What if I have a normal entry with some text in there, and I decide to
   comment it out, just temporarily.  All of a sudden this text no longer
   belongs to the entry, when I move the entry up or down, using
   structure editing commands, how should I decide in a safe way what
   comment does and what dow not belong to an entry?

The current outline implementation is at least clean in the sense
that it is totally predictable what will happen if you issue
certain commands.

I still believe that the best work-around it to have top-level
sections in your file, make the #+ARCHIVE lint the first line *inside*
the section, and then have your TODO items as level 2 entries below it.
If you are going to structure your document anyway in a way that
requires multiple archives, why not reflect this structure also
with top-level headlines?

- Carsten

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

* Re: possible misfeature regarding multiple #+ARCHIVE lines in a file
  2007-09-03  7:30   ` Carsten Dominik
@ 2007-09-03 17:43     ` Brian van den Broek
  2007-09-03 18:25       ` Carsten Dominik
  0 siblings, 1 reply; 7+ messages in thread
From: Brian van den Broek @ 2007-09-03 17:43 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik said unto the world upon 09/03/2007 03:30 AM:
> 
> On Sep 2, 2007, at 0:05, Brian van den Broek wrote:
> 
>> Brian van den Broek said unto the world upon 09/01/2007 05:51 PM:

<snip me pointing to a related discussion from an earlier thread.>

>>> It seems to me that a possible fix would be to look at the end of any 
>>> subtree that is being archived, and leave behind an #+ARCHIVE line 
>>> (or perhaps uninterrupted block of #+ lines) that terminates the tree 
>>> being archived.
>>
>> Now I am curious as to if this is unworkable. Carsten, if it is, would 
>> you mind briefly sketching why? (Time permitting, of course.)
> 
> 
> Hi Brian,
> 
> In principle the solution you propose is workable of course.
> You are, in fact, not the first to think of this: for example
> the file outline.el in Emacs 22 states:
> 
> ;;; Todo:
> 
> ;; - subtree-terminators
> ;; - better handle comments before function bodies (i.e. heading)
> ;; - don't bother hiding whitespace
> 
> This is an issue in many types of files that would like to use
> outline to get a structured view on a file.  For example
> Programmers often write comments *before* a function definition.


Hi Carsten,

Thanks for taking the time to shed some light. I'm not surprised that 
the line of attack I suggested has been considered before.

> I find it hard to envision a *clean* implementation, however.
> Problems with this approach are:
> 
> - Lets say we say that comments before a headline so not belong
>   to the entry before it.   Do they belong to the entry after it?
>   If I archive the entry after it, should I move the comment then?
> 
> - What if I have a normal entry with some text in there, and I decide to
>   comment it out, just temporarily.  All of a sudden this text no longer
>   belongs to the entry, when I move the entry up or down, using
>   structure editing commands, how should I decide in a safe way what
>   comment does and what dow not belong to an entry?


OK, I start to see why you are reluctant to change the current 
behaviour. Thinking this through, I see a real risk of explosion of 
special cases and that would indeed likely get ugly.

> The current outline implementation is at least clean in the sense
> that it is totally predictable what will happen if you issue
> certain commands.
> 
> I still believe that the best work-around it to have top-level
> sections in your file, make the #+ARCHIVE lint the first line *inside*
> the section, and then have your TODO items as level 2 entries below it.
> If you are going to structure your document anyway in a way that
> requires multiple archives, why not reflect this structure also
> with top-level headlines?

Well, that's what I am doing. I've a teaching.org where each course 
for the coming year is a level 1 headline. When the year is over, I 
want to archive each course level 1 headline as a level 2 subtree of a 
level 1 headline in my teachingarchive.org. The thought is that as I 
teach say Intro to Logic over the years, each iteration of the course 
when active will be in my teaching.org. When the term is done, each 
will course tree will get archived under a Intro to Logic level 1 
heading in my archive file. So, the end result in the archive would be:

* Intro to Logic
** Intro to Logic Fall20072008
** Intro to Logic Fall20082009

* Intro to Philosophy
** Intro to Philosophy 20072008
** Intro to Philosophy 20082009

etc.


The only way I can see to do it with #+ARCHIVE lines would be to have 
my teaching.org look like

* Heading setting ARCHIVE line for following tree
* Intro to Logic Fall20072008
* Heading setting ARCHIVE line for following tree
* Intro to Philosophy 20072008
etc.

That makes for ugly clutter, IMHO. (The problem is acute in my 
intended case, as each level 1 heading needs its own ARCHIVE line.)

But, since the archiving will be done for the entire course tree and 
at most twice a year, doing it by hand would be fine.

Thanks for shedding more light and for enduring the long posts :-)

Best,

Brian vdB

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

* Re: possible misfeature regarding multiple #+ARCHIVE lines in a file
  2007-09-03 17:43     ` Brian van den Broek
@ 2007-09-03 18:25       ` Carsten Dominik
  2007-09-03 19:31         ` Brian van den Broek
  0 siblings, 1 reply; 7+ messages in thread
From: Carsten Dominik @ 2007-09-03 18:25 UTC (permalink / raw)
  To: Brian van den Broek; +Cc: emacs-orgmode

Hi Brian,

On Sep 3, 2007, at 19:43, Brian van den Broek wrote:
> Well, that's what I am doing. I've a teaching.org where each course 
> for the coming year is a level 1 headline. When the year is over, I 
> want to archive each course level 1 headline as a level 2 subtree of a 
> level 1 headline in my teachingarchive.org. The thought is that as I 
> teach say Intro to Logic over the years, each iteration of the course 
> when active will be in my teaching.org. When the term is done, each 
> will course tree will get archived under a Intro to Logic level 1 
> heading in my archive file. So, the end result in the archive would 
> be:
>
> * Intro to Logic
> ** Intro to Logic Fall20072008
> ** Intro to Logic Fall20082009
>
> * Intro to Philosophy
> ** Intro to Philosophy 20072008
> ** Intro to Philosophy 20082009
>
> etc.
>
>
> The only way I can see to do it with #+ARCHIVE lines would be to have 
> my teaching.org look like
>
> * Heading setting ARCHIVE line for following tree
> * Intro to Logic Fall20072008
> * Heading setting ARCHIVE line for following tree
> * Intro to Philosophy 20072008
> etc.
>
> That makes for ugly clutter, IMHO. (The problem is acute in my 
> intended case, as each level 1 heading needs its own ARCHIVE line.)

I would say that this only requires a litte creative restructuring,
and to give up the idea that in teaching.org, courses must be level 1.

In teaching.org:

* Intro to Logic
#+ARCHIVE: archive settings for logic
** Fall200072008

* Intro to Philosophy
#+ARCHIVE: settings for philosophy
** FALL20072008


- Carsten

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

* Re: possible misfeature regarding multiple #+ARCHIVE lines in a file
  2007-09-03 18:25       ` Carsten Dominik
@ 2007-09-03 19:31         ` Brian van den Broek
  2007-09-03 20:43           ` Carsten Dominik
  0 siblings, 1 reply; 7+ messages in thread
From: Brian van den Broek @ 2007-09-03 19:31 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik said unto the world upon 09/03/2007 02:25 PM:
> Hi Brian,
> 
> On Sep 3, 2007, at 19:43, Brian van den Broek wrote:

<snip>

>> The only way I can see to do it with #+ARCHIVE lines would be to have 
>> my teaching.org look like
>>
>> * Heading setting ARCHIVE line for following tree
>> * Intro to Logic Fall20072008
>> * Heading setting ARCHIVE line for following tree
>> * Intro to Philosophy 20072008
>> etc.
>>
>> That makes for ugly clutter, IMHO. (The problem is acute in my 
>> intended case, as each level 1 heading needs its own ARCHIVE line.)
> 
> I would say that this only requires a litte creative restructuring,
> and to give up the idea that in teaching.org, courses must be level 1.
> 
> In teaching.org:
> 
> * Intro to Logic
> #+ARCHIVE: archive settings for logic
> ** Fall200072008
> 
> * Intro to Philosophy
> #+ARCHIVE: settings for philosophy
> ** FALL20072008
> 


Hi Carsten,

Sure that would work, if only I could get past the tunnel vision 
induced by my first conception of how to structure things ;-)

Thanks for the discussion.

Best,

Brian vdB

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

* Re: possible misfeature regarding multiple #+ARCHIVE lines in a file
  2007-09-03 19:31         ` Brian van den Broek
@ 2007-09-03 20:43           ` Carsten Dominik
  0 siblings, 0 replies; 7+ messages in thread
From: Carsten Dominik @ 2007-09-03 20:43 UTC (permalink / raw)
  To: Brian van den Broek; +Cc: emacs-orgmode


On Sep 3, 2007, at 21:31, Brian van den Broek wrote:
>
> Hi Carsten,
>
> Sure that would work, if only I could get past the tunnel vision 
> induced by my first conception of how to structure things ;-)

Man, that is beautifully said.  Nothing to add.
I' ll put that on a sign above my desk.

- Carsten

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

end of thread, other threads:[~2007-09-03 20:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-01 21:51 possible misfeature regarding multiple #+ARCHIVE lines in a file Brian van den Broek
2007-09-01 22:05 ` Brian van den Broek
2007-09-03  7:30   ` Carsten Dominik
2007-09-03 17:43     ` Brian van den Broek
2007-09-03 18:25       ` Carsten Dominik
2007-09-03 19:31         ` Brian van den Broek
2007-09-03 20:43           ` Carsten Dominik

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