浏览代码

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 年之前
父节点
当前提交
9ec705cb57
共有 1 个文件被更改,包括 14 次插入0 次删除
  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)