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

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

[elpa] externals/org 08e595f 1/2: org-agenda-get-scheduled: Fix wrong ma


From: ELPA Syncer
Subject: [elpa] externals/org 08e595f 1/2: org-agenda-get-scheduled: Fix wrong matches when WITH-HOUR is non-nil
Date: Thu, 25 Nov 2021 05:57:25 -0500 (EST)

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

    org-agenda-get-scheduled: Fix wrong matches when WITH-HOUR is non-nil
    
    * lisp/org-agenda.el (org-agenda-get-scheduled): Do not rely on regex
    match to judge that current headline is scheduled with time when
    WITH-HOUR argument is non-nil.  Limit regexp search when looking for
    scheduled timestamp in current headline and intentionally signal
    search error if something went wrong (headline without scheduled
    timestamp in planning line must not be encountered at this point in
    the code).
    
    This commit continues 77a9932b0 and 82197761.
---
 lisp/org-agenda.el | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 2a73816..dfab7b7 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -6398,7 +6398,14 @@ scheduled items with an hour specification like [h]h:mm."
     (if (org-element--cache-active-p)
         (org-element-cache-map
          (lambda (el)
-           (when (org-element-property :scheduled el)
+           (when (and (org-element-property :scheduled el)
+                      (or (not with-hour)
+                          (org-element-property
+                           :hour-start
+                           (org-element-property :scheduled el))
+                          (org-element-property
+                           :hour-end
+                           (org-element-property :scheduled el))))
              (goto-char (org-element-property :contents-begin el))
              (catch :skip
                (org-agenda-skip el)
@@ -6408,7 +6415,12 @@ scheduled items with an hour specification like [h]h:mm."
                                     1 -1))
                       (pos (save-excursion
                              (goto-char (org-element-property :contents-begin 
el))
-                             (re-search-forward regexp nil t)
+                             ;; We intentionally leave NOERROR
+                             ;; argument in `re-search-forward' nil.  If
+                             ;; the search fails here, something went
+                             ;; wrong and we are looking at
+                             ;; non-matching headline.
+                             (re-search-forward regexp (line-end-position))
                              (1- (match-beginning 1))))
                       (todo-state (org-element-property :todo-keyword el))
                      (donep (eq 'done (org-element-property :todo-type el)))



reply via email to

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