I have a DIFF/patch at the bottom of this e-mail [1] that provided the fix.
for the DIFF/patch.
I found that if I perform an agenda-search, and change
the sort method to priority or tag, then the agenda items
matching my search are indeed sorted in the correct order.
This lead me to think to inspect the code that is performing
the time/date comparison of entries found by the org-search-view.
I put a debug-watch on the function org-cmp-ts and set
the sort method to "ts-down". I ran an agenda search, and I
noticed that none of the entries matching my search had a 'ts-date
property.
I ran another agenda search (by tag) and noticed that the entries
being compared in the org-cmp-ts function did indeed have a 'ts-date
property.
So, I came to the conclusion that org-search-view does not give matching
entries a 'ts-date property. Also, the 'type property of these entries needed
the ts-date-type appended to their 'type property (e.g. "search timestamp"
instead of just "search"). Otherwise, the org-cmp-ts function would think
the two entries it was comparing did not have matching timestamp types
and simply return nil, indicating both entries were "equal" in sort order.
Thanks,
--Nate
[1]
I ran a DIFF of org-agenda.el (mine) against org-agenda.el (9.1.13) and
here's the DIFF.
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 322480c..5af6743 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -4567,6 +4567,9 @@ is active."
(goto-char beg)
(setq marker (org-agenda-new-marker (point))
category (org-get-category)
+ ts-date-pair (org-agenda-entry-get-agenda-timestamp (point))
+ ts-date (car ts-date-pair)
+ ts-date-type (cdr ts-date-pair)
level (make-string (org-reduced-level (org-outline-level)) ? )
inherited-tags
(or (eq org-agenda-show-inherited-tags 'always)
@@ -4584,10 +4587,12 @@ is active."
(org-add-props txt props
'org-marker marker 'org-hd-marker marker
'org-todo-regexp org-todo-regexp
+ 'ts-date ts-date
+ 'ts-date-type ts-date-type
'level level
'org-complex-heading-regexp org-complex-heading-regexp
'priority 1000
- 'type "search")
+ 'type (concat "search" ts-date-type))
(push txt ee)
(goto-char (1- end))))))))))
(setq rtn (nreverse ee))