lang/org: fix edge case in +org--insert-item

This commit is contained in:
Henrik Lissner 2020-07-27 03:07:04 -04:00
parent 046dfb6475
commit 0e73297707
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -34,10 +34,16 @@
;; insert the new list item.
(if (eq direction 'above)
(org-beginning-of-item)
(org-end-of-item))
(if (org-element-property :checkbox context)
(org-insert-todo-heading nil)
(org-insert-item)))
(org-end-of-item)
(backward-char))
(org-insert-item (org-element-property :checkbox context))
;; Handle edge case where current item is empty and bottom of list is
;; flush against a new heading.
(when (and (eq direction 'below)
(eq (org-element-property :contents-begin context)
(org-element-property :contents-end context)))
(org-end-of-item)
(org-end-of-line)))
;; Add a new table row
((or `table `table-row)