From fe9ac47afc736091fd8538faf929c9fec05a66d3 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Thu, 10 Dec 2009 09:23:58 +0100 Subject: [PATCH] Archiving: Fix bug when archiving all DONE children in odd-level file Daniel S. Sinder writes: > Here's an "odd" problem when I call org-archive-subtree with a > prefix argument. It seems that DONE subtrees are not found if > I'm using odd level headlines. I've tried this minimal test > case: > > ---- begin: test case 1 ---- > #+STARTUP: hidestars odd > > * DONE Project 1 > *** DONE Task 1.1 > *** DONE Task 1.2 > ---- end: test case 1 ---- > > If I put the cursor on the level-1 headline and do C-u C-c C-x > C-s, I am not prompted if I want to archive the level-3 children. > However, if I remove 'odd' from the STARTUP line and move the > level 3 headlines to level 2, so I have this: > > ---- begin: test case 1 ---- > #+STARTUP: hidestars > > * DONE Project 1 > ** DONE Task 1.1 > ** DONE Task 1.2 > ---- end: test case 1 ---- > > then a repeat of the same command (C-u C-c C-x C-s) correctly > asks if I want to archive the two level-2 headlines. > > I've removed my personal customizations and the problem does not > go away. --- lisp/ChangeLog | 3 +++ lisp/org-archive.el | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 727622137..a52f108aa 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2009-12-10 Carsten Dominik + * org-archive.el (org-archive-all-done): Make this work in a file + with org-odd-levels-only set. + * org.el (org-get-refile-targets): Catch the case when a buffer has no file. diff --git a/lisp/org-archive.el b/lisp/org-archive.el index 615ff5152..ee58cf82e 100644 --- a/lisp/org-archive.el +++ b/lisp/org-archive.el @@ -389,7 +389,8 @@ When TAG is non-nil, don't move trees, but mark them with the ARCHIVE tag." (progn (setq re1 (concat "^" (regexp-quote (make-string - (1+ (- (match-end 0) (match-beginning 0) 1)) + (+ (- (match-end 0) (match-beginning 0) 1) + (if org-odd-levels-only 2 1)) ?*)) " ")) (move-marker begm (point)) -- 2.11.4.GIT