From 69bf8ef2b4f5f24d068a5ad0cbf294ac714130be Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Tue, 21 Oct 2008 22:29:03 +0200 Subject: [PATCH] Fix bug with sibling archiving on top level. --- lisp/ChangeLog | 5 +++++ lisp/org-archive.el | 11 ++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 77735f9c4..e6841cd64 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2008-10-21 Carsten Dominik + + * org-archive.el (org-archive-to-archive-sibling): Handle top + level headlines better. + 2008-10-21 Bastien Guerry * org-export-latex.el (org-export-latex-classes): Added diff --git a/lisp/org-archive.el b/lisp/org-archive.el index 91705775e..144087238 100644 --- a/lisp/org-archive.el +++ b/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)