Ver código fonte

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.
Nicolas Goaziou 9 anos atrás
pai
commit
2e5981e003
1 arquivos alterados com 4 adições e 3 exclusões
  1. 4 3
      lisp/org-element.el

+ 4 - 3
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)))