org.el/org-at-planning-p: Add cache support
This commit is contained in:
parent
68a44eadac
commit
7159ec0be0
21
lisp/org.el
21
lisp/org.el
|
@ -10770,15 +10770,18 @@ nil."
|
||||||
"Non-nil when point is on a planning info line."
|
"Non-nil when point is on a planning info line."
|
||||||
;; This is as accurate and faster than `org-element-at-point' since
|
;; This is as accurate and faster than `org-element-at-point' since
|
||||||
;; planning info location is fixed in the section.
|
;; planning info location is fixed in the section.
|
||||||
(org-with-wide-buffer
|
(or (let ((cached (org-element-at-point nil 'cached)))
|
||||||
(beginning-of-line)
|
(and cached
|
||||||
(and (looking-at-p org-planning-line-re)
|
(eq 'planning (org-element-type cached))))
|
||||||
(eq (point)
|
(org-with-wide-buffer
|
||||||
(ignore-errors
|
(beginning-of-line)
|
||||||
(if (and (featurep 'org-inlinetask) (org-inlinetask-in-task-p))
|
(and (looking-at-p org-planning-line-re)
|
||||||
(org-back-to-heading t)
|
(eq (point)
|
||||||
(org-with-limited-levels (org-back-to-heading t)))
|
(ignore-errors
|
||||||
(line-beginning-position 2))))))
|
(if (and (featurep 'org-inlinetask) (org-inlinetask-in-task-p))
|
||||||
|
(org-back-to-heading t)
|
||||||
|
(org-with-limited-levels (org-back-to-heading t)))
|
||||||
|
(line-beginning-position 2)))))))
|
||||||
|
|
||||||
(defun org-add-planning-info (what &optional time &rest remove)
|
(defun org-add-planning-info (what &optional time &rest remove)
|
||||||
"Insert new timestamp with keyword in the planning line.
|
"Insert new timestamp with keyword in the planning line.
|
||||||
|
|
Loading…
Reference in New Issue