forked from mirrors/org-mode
org-search-view: Fix searching across inlinetasks
* lisp/org-agenda.el (org-search-view): Consider that `outline-next-heading' may move to inlinetask. * testing/examples/agenda-search.org: New test file. * testing/lisp/test-org-agenda.el (test-org-agenda/org-search-view): New test. Reported-by: Alain.Cochard@unistra.fr Link: https://orgmode.org/list/25514.763.379510.806150@gargle.gargle.HOWL
This commit is contained in:
parent
ecfb55af0a
commit
fc4bbb28f8
|
@ -4678,7 +4678,7 @@ is active."
|
||||||
(org-agenda-text-search-extra-files org-agenda-text-search-extra-files)
|
(org-agenda-text-search-extra-files org-agenda-text-search-extra-files)
|
||||||
regexp rtn rtnall files file pos inherited-tags
|
regexp rtn rtnall files file pos inherited-tags
|
||||||
marker category level tags c neg re boolean
|
marker category level tags c neg re boolean
|
||||||
ee txt beg end words regexps+ regexps- hdl-only buffer beg1 str)
|
ee txt beg end last-search-end words regexps+ regexps- hdl-only buffer beg1 str)
|
||||||
(unless (and (not edit-at)
|
(unless (and (not edit-at)
|
||||||
(stringp string)
|
(stringp string)
|
||||||
(string-match "\\S-" string))
|
(string-match "\\S-" string))
|
||||||
|
@ -4817,6 +4817,7 @@ is active."
|
||||||
(throw 'nextfile t))
|
(throw 'nextfile t))
|
||||||
(goto-char (max (point-min) (1- (point))))
|
(goto-char (max (point-min) (1- (point))))
|
||||||
(while (re-search-forward regexp nil t)
|
(while (re-search-forward regexp nil t)
|
||||||
|
(setq last-search-end (point))
|
||||||
(org-back-to-heading t)
|
(org-back-to-heading t)
|
||||||
(while (and (not (zerop org-agenda-search-view-max-outline-level))
|
(while (and (not (zerop org-agenda-search-view-max-outline-level))
|
||||||
(> (org-reduced-level (org-outline-level))
|
(> (org-reduced-level (org-outline-level))
|
||||||
|
@ -4878,7 +4879,7 @@ is active."
|
||||||
'priority 1000
|
'priority 1000
|
||||||
'type "search")
|
'type "search")
|
||||||
(push txt ee)
|
(push txt ee)
|
||||||
(goto-char (1- end))))))))))
|
(goto-char (max (1- end) last-search-end))))))))))
|
||||||
(setq rtn (nreverse ee))
|
(setq rtn (nreverse ee))
|
||||||
(setq rtnall (append rtnall rtn)))
|
(setq rtnall (append rtnall rtn)))
|
||||||
(org-agenda--insert-overriding-header
|
(org-agenda--insert-overriding-header
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
* Test heading with text
|
||||||
|
foo
|
||||||
|
* Test heading with inlinetask
|
||||||
|
foo
|
||||||
|
****************** inline
|
||||||
|
text inside inlinetask
|
||||||
|
****************** END
|
||||||
|
bar
|
|
@ -115,6 +115,31 @@ See https://list.orgmode.org/20220101200103.GB29829@itccanarias.org/T/#t."
|
||||||
(should (= 2 (count-lines (point-min) (point-max)))))
|
(should (= 2 (count-lines (point-min) (point-max)))))
|
||||||
(org-test-agenda--kill-all-agendas))
|
(org-test-agenda--kill-all-agendas))
|
||||||
|
|
||||||
|
(ert-deftest test-org-agenda/org-search-view ()
|
||||||
|
"Test `org-search-view' specifications."
|
||||||
|
(cl-assert (not org-agenda-sticky) nil "precondition violation")
|
||||||
|
(cl-assert (not (org-test-agenda--agenda-buffers))
|
||||||
|
nil "precondition violation")
|
||||||
|
;; Search a string.
|
||||||
|
(let ((org-agenda-files `(,(expand-file-name "examples/agenda-search.org"
|
||||||
|
org-test-dir))))
|
||||||
|
(org-search-view nil "foo")
|
||||||
|
(set-buffer org-agenda-buffer-name)
|
||||||
|
(should (= 4 (count-lines (point-min) (point-max)))))
|
||||||
|
;; Search past inlinetask.
|
||||||
|
(let ((org-agenda-files `(,(expand-file-name "examples/agenda-search.org"
|
||||||
|
org-test-dir))))
|
||||||
|
(org-search-view nil "bar")
|
||||||
|
(set-buffer org-agenda-buffer-name)
|
||||||
|
(should (= 3 (count-lines (point-min) (point-max)))))
|
||||||
|
;; Search inside inlinetask.
|
||||||
|
(let ((org-agenda-files `(,(expand-file-name "examples/agenda-search.org"
|
||||||
|
org-test-dir))))
|
||||||
|
(org-search-view nil "text inside inlinetask")
|
||||||
|
(set-buffer org-agenda-buffer-name)
|
||||||
|
(should (= 3 (count-lines (point-min) (point-max)))))
|
||||||
|
(org-test-agenda--kill-all-agendas))
|
||||||
|
|
||||||
(ert-deftest test-org-agenda/property-timestamp ()
|
(ert-deftest test-org-agenda/property-timestamp ()
|
||||||
"Match timestamps inside property drawer.
|
"Match timestamps inside property drawer.
|
||||||
See https://list.orgmode.org/06d301d83d9e$f8b44340$ea1cc9c0$@tomdavey.com"
|
See https://list.orgmode.org/06d301d83d9e$f8b44340$ea1cc9c0$@tomdavey.com"
|
||||||
|
|
Loading…
Reference in New Issue