Browse Source

Fix bug with sibling archiving on top level.

Carsten Dominik 16 years ago
parent
commit
69bf8ef2b4
2 changed files with 11 additions and 5 deletions
  1. 5 0
      lisp/ChangeLog
  2. 6 5
      lisp/org-archive.el

+ 5 - 0
lisp/ChangeLog

@@ -1,3 +1,8 @@
+2008-10-21  Carsten Dominik  <dominik@science.uva.nl>
+
+	* org-archive.el (org-archive-to-archive-sibling): Handle top
+	level headlines better.
+
 2008-10-21  Bastien Guerry  <bzg@altern.org>
 
 	* org-export-latex.el (org-export-latex-classes): Added

+ 6 - 5
lisp/org-archive.el

@@ -322,12 +322,13 @@ sibling does not exist, it will be created at the end of the subtree."
       (setq pos (point))
       (condition-case nil
 	  (outline-up-heading 1 t)
-	(error (goto-char (point-min))))
+	(error (setq e (point-max)) (goto-char (point-min))))
       (setq b (point))
-      (condition-case nil
-	  (org-end-of-subtree t t)
-	(error (goto-char (point-max))))
-      (setq e (point))
+      (unless e
+	(condition-case nil
+	    (org-end-of-subtree t t)
+	  (error (goto-char (point-max))))
+	(setq e (point)))
       (goto-char b)
       (unless (re-search-forward
 	       (concat "^" (regexp-quote leader)