forked from mirrors/org-mode
org-list: Avoid unnecessary call to `org-in-item-p'
* lisp/org-list.el (org-list-insert-item): Compute item containing POS based on the list structure instead of the buffer.
This commit is contained in:
parent
a8a8f70039
commit
0c03971b09
|
@ -1258,10 +1258,18 @@ function ends.
|
||||||
|
|
||||||
This function modifies STRUCT."
|
This function modifies STRUCT."
|
||||||
(let ((case-fold-search t))
|
(let ((case-fold-search t))
|
||||||
;; 1. Get information about list: position of point with regards
|
;; 1. Get information about list: ITEM containing POS, position of
|
||||||
;; to item start (BEFOREP), blank lines number separating items
|
;; point with regards to item start (BEFOREP), blank lines
|
||||||
;; (BLANK-NB), if we're allowed to (SPLIT-LINE-P).
|
;; number separating items (BLANK-NB), if we're allowed to
|
||||||
(let* ((item (progn (goto-char pos) (goto-char (org-list-get-item-begin))))
|
;; (SPLIT-LINE-P).
|
||||||
|
(let* ((item (goto-char (catch :exit
|
||||||
|
(let ((inner-item 0))
|
||||||
|
(pcase-dolist (`(,i . ,_) struct)
|
||||||
|
(cond
|
||||||
|
((= i pos) (throw :exit i))
|
||||||
|
((< i pos) (setq inner-item i))
|
||||||
|
(t (throw :exit inner-item))))
|
||||||
|
inner-item))))
|
||||||
(item-end (org-list-get-item-end item struct))
|
(item-end (org-list-get-item-end item struct))
|
||||||
(item-end-no-blank (org-list-get-item-end-before-blank item struct))
|
(item-end-no-blank (org-list-get-item-end-before-blank item struct))
|
||||||
(beforep
|
(beforep
|
||||||
|
|
Loading…
Reference in a new issue