From 2e5981e003a4a47a0a3c3a11b574c9148c83436d Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Tue, 9 Jun 2015 17:05:21 +0200 Subject: [PATCH] org-element: Fix structure for list elements containing a drawer * lisp/org-element.el (org-element--list-struct): Fix return value when a drawer is found within an item. --- lisp/org-element.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index be19dd28e..5a7e578d9 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -1333,7 +1333,8 @@ CONTENTS is the contents of the element." (goto-char origin))))) ;; At some text line. Check if it ends any previous item. (t - (let ((ind (progn (skip-chars-forward " \t") (current-column)))) + (let ((ind (save-excursion (skip-chars-forward " \t") + (current-column)))) (when (<= ind top-ind) (skip-chars-backward " \r\t\n") (forward-line)) @@ -1342,10 +1343,10 @@ CONTENTS is the contents of the element." (setcar (nthcdr 6 item) (line-beginning-position)) (push item struct) (unless items - (throw 'exit (sort struct 'car-less-than-car)))))) + (throw 'exit (sort struct #'car-less-than-car)))))) ;; Skip blocks (any type) and drawers contents. (cond - ((and (looking-at "#\\+BEGIN\\(:\\|_\\S-+\\)") + ((and (looking-at "[ \t]*#\\+BEGIN\\(:\\|_\\S-+\\)") (re-search-forward (format "^[ \t]*#\\+END%s[ \t]*$" (match-string 1)) limit t))) -- 2.11.4.GIT