summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2009-12-10 09:23:58 +0100
committerCarsten Dominik <carsten.dominik@gmail.com>2009-12-10 09:23:58 +0100
commitfe9ac47afc736091fd8538faf929c9fec05a66d3 (patch)
tree377d9b82544738d31ea4b5207257f780443e1f91
parent0077ce97eaa953f047bd7920ef46d13527051845 (diff)
downloadorg-mode-fe9ac47afc736091fd8538faf929c9fec05a66d3.tar.gz
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.
-rwxr-xr-xlisp/ChangeLog3
-rw-r--r--lisp/org-archive.el3
2 files changed, 5 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7276221..a52f108 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -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.
diff --git a/lisp/org-archive.el b/lisp/org-archive.el
index 615ff51..ee58cf8 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))