summaryrefslogtreecommitdiff
path: root/lisp/org/org-element.el
diff options
context:
space:
mode:
authorRasmus <rasmus@gmx.us>2017-12-06 15:02:15 +0100
committerRasmus <rasmus@gmx.us>2017-12-06 15:37:41 +0100
commit445eefd238eb7c3843e18cd265c05f07233f8aff (patch)
tree1b80ecda2301629cf8e1f0b2941e1f729952ca84 /lisp/org/org-element.el
parent5381c70b7a9d46fe4de205363b99f761e2475f1f (diff)
downloademacs-445eefd238eb7c3843e18cd265c05f07233f8aff.tar.gz
emacs-445eefd238eb7c3843e18cd265c05f07233f8aff.tar.bz2
emacs-445eefd238eb7c3843e18cd265c05f07233f8aff.zip
Backport: Update Org to v9.1.4
Please note this is a bugfix release. See etc/ORG-NEWS for details. (cherry picked from commit 567b5efe1f338c10c574758fb968915c5c34c909)
Diffstat (limited to 'lisp/org/org-element.el')
-rw-r--r--lisp/org/org-element.el35
1 files changed, 16 insertions, 19 deletions
diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el
index f2b3002f1fd..c5f656e09ea 100644
--- a/lisp/org/org-element.el
+++ b/lisp/org/org-element.el
@@ -1308,23 +1308,19 @@ CONTENTS is the contents of the element."
(inlinetask-re (and (featurep 'org-inlinetask) "^\\*+ "))
items struct)
(save-excursion
- (catch 'exit
+ (catch :exit
(while t
(cond
;; At limit: end all items.
((>= (point) limit)
- (throw 'exit
- (let ((end (progn (skip-chars-backward " \r\t\n")
- (forward-line)
- (point))))
- (dolist (item items (sort (nconc items struct)
- 'car-less-than-car))
- (setcar (nthcdr 6 item) end)))))
+ (let ((end (progn (skip-chars-backward " \r\t\n")
+ (line-beginning-position 2))))
+ (dolist (item items) (setcar (nthcdr 6 item) end)))
+ (throw :exit (sort (nconc items struct) #'car-less-than-car)))
;; At list end: end all items.
((looking-at org-list-end-re)
- (throw 'exit (dolist (item items (sort (nconc items struct)
- 'car-less-than-car))
- (setcar (nthcdr 6 item) (point)))))
+ (dolist (item items) (setcar (nthcdr 6 item) (point)))
+ (throw :exit (sort (nconc items struct) #'car-less-than-car)))
;; At a new item: end previous sibling.
((looking-at item-re)
(let ((ind (save-excursion (skip-chars-forward " \t")
@@ -1348,7 +1344,7 @@ CONTENTS is the contents of the element."
;; Ending position, unknown so far.
nil)))
items))
- (forward-line 1))
+ (forward-line))
;; Skip empty lines.
((looking-at "^[ \t]*$") (forward-line))
;; Skip inline tasks and blank lines along the way.
@@ -1360,17 +1356,18 @@ CONTENTS is the contents of the element."
(goto-char origin)))))
;; At some text line. Check if it ends any previous item.
(t
- (let ((ind (save-excursion (skip-chars-forward " \t")
- (current-column))))
- (when (<= ind top-ind)
- (skip-chars-backward " \r\t\n")
- (forward-line))
+ (let ((ind (save-excursion
+ (skip-chars-forward " \t")
+ (current-column)))
+ (end (save-excursion
+ (skip-chars-backward " \r\t\n")
+ (line-beginning-position 2))))
(while (<= ind (nth 1 (car items)))
(let ((item (pop items)))
- (setcar (nthcdr 6 item) (line-beginning-position))
+ (setcar (nthcdr 6 item) end)
(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 "[ \t]*#\\+BEGIN\\(:\\|_\\S-+\\)")