Browse Source

Allow escaped spaces in agenda search view

* lisp/org-agenda.el (org-search-view): Recover spaces in search words
if they were escaped with \ or inside a regexp.
Carsten Dominik 14 years ago
parent
commit
9ec705cb57
1 changed files with 14 additions and 0 deletions
  1. 14 0
      lisp/org-agenda.el

+ 14 - 0
lisp/org-agenda.el

@@ -3556,6 +3556,20 @@ in `org-agenda-text-search-extra-files'."
 	    (member (string-to-char words) '(?- ?+ ?\{)))
 	(setq boolean t))
     (setq words (org-split-string words))
+    (let (www w)
+      (while (setq w (pop words))
+	(while (and (string-match "\\\\\\'" w) words)
+	  (setq w (concat (substring w 0 -1) " " (pop words))))
+	(push w www))
+      (setq words (nreverse www) www nil)
+      (while (setq w (pop words))
+	(when (and (string-match "\\`[-+]?{" w)
+		   (not (string-match "}\\'" w)))
+	  (while (and words (not (string-match "}\\'" (car words))))
+	    (setq w (concat w " " (pop words))))
+	  (setq w (concat w " " (pop words))))
+	(push w www))
+      (setq words (nreverse www)))
     (setq org-agenda-last-search-view-search-was-boolean boolean)
     (when boolean
       (let (wds w)