Compare commits
2 Commits
1ae978f940
...
942a7320d0
Author | SHA1 | Date |
---|---|---|
Morgan Smith | 942a7320d0 | |
Ihor Radchenko | d73688faa4 |
|
@ -8292,8 +8292,11 @@ the cache."
|
|||
;; Reached LIMIT-COUNT. Abort.
|
||||
(when (and limit-count
|
||||
(>= count-predicate-calls-match
|
||||
limit-count))
|
||||
(cache-walk-abort)))
|
||||
limit-count))
|
||||
(cache-walk-abort))
|
||||
;; Make sure that we have a cached
|
||||
;; element at the new STAR.
|
||||
(when start (element-match-at-point)))
|
||||
;; Check if the buffer or cache has been modified.
|
||||
(unless (org-with-base-buffer nil
|
||||
(and (eq modified-tic org-element--cache-change-tic)
|
||||
|
|
|
@ -7332,13 +7332,12 @@ When REMOVE is non-nil, remove the subtree from the clipboard."
|
|||
((looking-at-p org-outline-regexp-bol) (org-outline-level))))
|
||||
(previous-level
|
||||
(save-excursion
|
||||
(org-previous-visible-heading 1)
|
||||
(unless (org-at-heading-p) (org-previous-visible-heading 1))
|
||||
(if (org-at-heading-p) (org-outline-level) 1)))
|
||||
(next-level
|
||||
(save-excursion
|
||||
(if (org-at-heading-p) (org-outline-level)
|
||||
(org-next-visible-heading 1)
|
||||
(if (org-at-heading-p) (org-outline-level) 1))))
|
||||
(org-next-visible-heading 1)
|
||||
(if (org-at-heading-p) (org-outline-level) 1)))
|
||||
(new-level (or force-level (max previous-level next-level)))
|
||||
(shift (if (or (= old-level -1)
|
||||
(= new-level -1)
|
||||
|
|
|
@ -4983,6 +4983,18 @@ Text
|
|||
|
||||
|
||||
;;; Test Cache.
|
||||
(ert-deftest test-org-element/cache-map ()
|
||||
"Test `org-element-cache-map'."
|
||||
(org-test-with-temp-text "* headline\n:DRAWER:\nparagraph\n:END:\n* headline 2"
|
||||
(should
|
||||
(equal
|
||||
'(org-data headline section drawer paragraph headline)
|
||||
(org-element-cache-map #'car :granularity 'element))))
|
||||
(should
|
||||
(equal
|
||||
'(org-data headline section drawer paragraph)
|
||||
(org-test-with-temp-text "* headline\n:DRAWER:\nparagraph\n:END:"
|
||||
(org-element-cache-map #'car :granularity 'element)))))
|
||||
|
||||
(ert-deftest test-org-element/cache ()
|
||||
"Test basic expectations and common pitfalls for cache."
|
||||
|
|
|
@ -9372,6 +9372,24 @@ CLOSED: %s
|
|||
(org-test-with-temp-text "* H1\n<point>\n** H2"
|
||||
(org-paste-subtree nil "* Text")
|
||||
(buffer-string))))
|
||||
;; When point is on heading at bol, insert before
|
||||
(should
|
||||
(equal "* Text\n* H1\n** H2"
|
||||
(org-test-with-temp-text "<point>* H1\n** H2"
|
||||
(org-paste-subtree nil "*** Text")
|
||||
(buffer-string))))
|
||||
;; When point is on heading but not at bol, use smallest level among
|
||||
;; current heading and next, inserting before the next heading.
|
||||
(should
|
||||
(equal "* H1\ncontents\n** Text\n** H2"
|
||||
(org-test-with-temp-text "* H1<point>\ncontents\n** H2"
|
||||
(org-paste-subtree nil "*** Text")
|
||||
(buffer-string))))
|
||||
(should
|
||||
(equal "*** H1\ncontents\n*** Text\n* H2"
|
||||
(org-test-with-temp-text "*** H1<point>\ncontents\n* H2"
|
||||
(org-paste-subtree nil "* Text")
|
||||
(buffer-string))))
|
||||
;; When on an empty heading, after the stars, deduce the new level
|
||||
;; from the number of stars.
|
||||
(should
|
||||
|
|
Loading…
Reference in New Issue