From 0aa0fdd9713cd06cf18bc3827416aeb26d2b4cc6 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sat, 6 Jul 2013 00:39:28 +0200 Subject: [PATCH] org-element: Fix interpretation of empty items * lisp/org-element.el (org-element-item-interpreter): This patch fixes "(wrong-type-argument arrayp nil)" error when trying to interpret empty items. * testing/lisp/test-org-element.el: Add test. --- lisp/org-element.el | 9 +++++---- testing/lisp/test-org-element.el | 4 +++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index c5d9ee99c..e6f4a4628 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -1142,10 +1142,11 @@ CONTENTS is the contents of the element." (off "[ ] ") (trans "[-] ")) (and tag (format "%s :: " tag)) - (let ((contents (replace-regexp-in-string - "\\(^\\)[ \t]*\\S-" ind contents nil nil 1))) - (if item-starts-with-par-p (org-trim contents) - (concat "\n" contents)))))) + (when contents + (let ((contents (replace-regexp-in-string + "\\(^\\)[ \t]*\\S-" ind contents nil nil 1))) + (if item-starts-with-par-p (org-trim contents) + (concat "\n" contents))))))) ;;;; Plain List diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el index e3927fe2a..5cfe95afe 100644 --- a/testing/lisp/test-org-element.el +++ b/testing/lisp/test-org-element.el @@ -2168,7 +2168,9 @@ Outside list" (equal (org-test-parse-and-interpret "-\n | a | b |") "- \n | a | b |\n")) ;; Special case: correctly handle "*" bullets. - (should (org-test-parse-and-interpret " * item")))) + (should (org-test-parse-and-interpret " * item")) + ;; Special case: correctly handle empty items. + (should (org-test-parse-and-interpret "-")))) (ert-deftest test-org-element/quote-block-interpreter () "Test quote block interpreter." -- 2.11.4.GIT