org-at-item-p: Use org-element API

This commit is contained in:
Ihor Radchenko 2023-05-07 10:02:18 +02:00
parent fefaadc2d5
commit 6266197bbd
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 9 additions and 2 deletions

View File

@ -485,11 +485,18 @@ group 4: description tag")
(forward-line -1))
(t (forward-line -1)))))))))))
;; FIXME: We should make use of org-element API in more places here.
(defun org-at-item-p ()
"Is point in a line starting a hand-formatted item?"
"Is point in a line starting a hand-formatted item?
Modify match data, matching against `org-item-re'."
(save-excursion
(beginning-of-line)
(and (looking-at (org-item-re)) (org-list-in-valid-context-p))))
(and
(org-element-type-p
(org-element-at-point)
'(plain-list item))
;; Set match data.
(looking-at (org-item-re)))))
(defun org-at-item-bullet-p ()
"Is point at the bullet of a plain list item?"