emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org 7159ec0 05/29: org.el/org-at-planning-p: Add cache


From: ELPA Syncer
Subject: [elpa] externals/org 7159ec0 05/29: org.el/org-at-planning-p: Add cache support
Date: Sun, 17 Oct 2021 02:57:25 -0400 (EDT)

branch: externals/org
commit 7159ec0be0a88b19a955256405ee56b4828b4f7d
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>

    org.el/org-at-planning-p: Add cache support
---
 lisp/org.el | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index ba3ca1c..8cedfcb 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10770,15 +10770,18 @@ nil."
   "Non-nil when point is on a planning info line."
   ;; This is as accurate and faster than `org-element-at-point' since
   ;; planning info location is fixed in the section.
-  (org-with-wide-buffer
-   (beginning-of-line)
-   (and (looking-at-p org-planning-line-re)
-       (eq (point)
-           (ignore-errors
-             (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))))))
+  (or (let ((cached (org-element-at-point nil 'cached)))
+        (and cached
+             (eq 'planning (org-element-type cached))))
+      (org-with-wide-buffer
+       (beginning-of-line)
+       (and (looking-at-p org-planning-line-re)
+           (eq (point)
+               (ignore-errors
+                 (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)
   "Insert new timestamp with keyword in the planning line.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]