branch: externals/org
commit dba92f72d3cc0c3f305ec8ac3f6f6682f02a8776
Merge: 5b0b7f2924 0db82ee8f8
Author: Ihor Radchenko <[email protected]>
Commit: Ihor Radchenko <[email protected]>

    Merge branch 'bugfix'
---
 lisp/org-agenda.el | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 638f483a11..9f790d8dfa 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -8595,6 +8595,14 @@ Negative selection means regexp must not match for 
selection of an entry."
       (org-agenda-redo))
     (message "Display now includes inactive timestamps as well"))
    ((eq org-agenda-type 'search)
+    ;; Previous calls to `org-agenda-manipulate-query' could already
+    ;; add trailing text to the query.  Prevent duplicating it.
+    ;; Trim the trailing spaces and +/.
+    (setq org-agenda-query-string
+          (replace-regexp-in-string
+           (rx (or (1+ " ") (seq (1+ " ") (any "+-") (opt "{}"))) eos)
+           ""
+           org-agenda-query-string))
     (org-add-to-string
      'org-agenda-query-string
      (if org-agenda-last-search-view-search-was-boolean

Reply via email to