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

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

[elpa] externals/org 5549357bf2: Merge branch 'bugfix'


From: ELPA Syncer
Subject: [elpa] externals/org 5549357bf2: Merge branch 'bugfix'
Date: Tue, 27 Dec 2022 05:57:57 -0500 (EST)

branch: externals/org
commit 5549357bf2cccc5ae3c58eb92e997126faa9fb5b
Merge: af56f52ccb fc4bbb28f8
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    Merge branch 'bugfix'
---
 lisp/org-agenda.el                 |  5 +++--
 testing/examples/agenda-search.org |  8 ++++++++
 testing/lisp/test-org-agenda.el    | 25 +++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index ea5f6f5621..fdcef9453b 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -4680,7 +4680,7 @@ is active."
         (org-agenda-text-search-extra-files org-agenda-text-search-extra-files)
         regexp rtn rtnall files file pos inherited-tags
         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)
                 (stringp string)
                 (string-match "\\S-" string))
@@ -4819,6 +4819,7 @@ is active."
                      (throw 'nextfile t))
                    (goto-char (max (point-min) (1- (point))))
                    (while (re-search-forward regexp nil t)
+                      (setq last-search-end (point))
                      (org-back-to-heading t)
                      (while (and (not (zerop 
org-agenda-search-view-max-outline-level))
                                  (> (org-reduced-level (org-outline-level))
@@ -4880,7 +4881,7 @@ is active."
                          'priority 1000
                          'type "search")
                        (push txt ee)
-                       (goto-char (1- end))))))))))
+                       (goto-char (max (1- end) last-search-end))))))))))
        (setq rtn (nreverse ee))
        (setq rtnall (append rtnall rtn)))
       (org-agenda--insert-overriding-header
diff --git a/testing/examples/agenda-search.org 
b/testing/examples/agenda-search.org
new file mode 100644
index 0000000000..2772acf2ef
--- /dev/null
+++ b/testing/examples/agenda-search.org
@@ -0,0 +1,8 @@
+* Test heading with text
+foo
+* Test heading with inlinetask
+foo
+****************** inline
+text inside inlinetask
+****************** END
+bar
diff --git a/testing/lisp/test-org-agenda.el b/testing/lisp/test-org-agenda.el
index bd96163e94..c138d5668c 100644
--- a/testing/lisp/test-org-agenda.el
+++ b/testing/lisp/test-org-agenda.el
@@ -115,6 +115,31 @@ See 
https://list.orgmode.org/20220101200103.GB29829@itccanarias.org/T/#t.";
     (should (= 2 (count-lines (point-min) (point-max)))))
   (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 ()
   "Match timestamps inside property drawer.
 See https://list.orgmode.org/06d301d83d9e$f8b44340$ea1cc9c0$@tomdavey.com";



reply via email to

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