diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b9190ed73..3e4e7c5d9 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2009-04-22 Carsten Dominik + + * org-exp.el (org-export-remove-or-extract-drawers): Handle empty + drawers, and drawers that are missing the :END: line. + 2009-04-21 Carsten Dominik * org-clock.el (org-clock-goto): Go to recently clocked task if no diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 382187f92..187cd79ce 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -1447,10 +1447,20 @@ whose content to keep." (org-delete-all exp-drawers (copy-sequence all-drawers)) "\\|") - "\\):[ \t]*\n\\([^\000]*?\n\\)?[ \t]*:END:[ \t]*\n"))) + "\\):[ \t]*$")) + beg eol) (while (re-search-forward re nil t) (org-if-unprotected - (replace-match "")))))) + (setq beg (match-beginning 0) + eol (match-end 0)) + (if (re-search-forward "^\\([ \t]*:END:[ \t]*\n?\\)\\|^\\*+[ \t]" + nil t) + (if (match-end 1) + ;; terminated in this entry + (progn + (delete-region beg (match-end 1)) + (goto-char beg)) + (goto-char eol)))))))) (defun org-export-handle-export-tags (select-tags exclude-tags) "Modify the buffer, honoring SELECT-TAGS and EXCLUDE-TAGS.