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.
This commit is contained in:
Carsten Dominik 2009-12-10 09:23:58 +01:00
parent 0077ce97ea
commit fe9ac47afc
2 changed files with 5 additions and 1 deletions

View File

@ -1,5 +1,8 @@
2009-12-10 Carsten Dominik <carsten.dominik@gmail.com>
* 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.

View File

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