浏览代码

Completion: Allow spaces in some fields

Org has a number of places where the value read by completing-read may
contains spaces.  For these occasions, the space character needs to be
a normal character.

The recent support for ido.el invalidated these special cases because
ido has its own way of dealing with spaces.

This commit now makes sure that ido is off for the critical cases
where completion must allow spaces.
Carsten Dominik 16 年之前
父节点
当前提交
3c121459b4
共有 3 个文件被更改,包括 20 次插入8 次删除
  1. 7 0
      lisp/ChangeLog
  2. 2 2
      lisp/org-remember.el
  3. 11 6
      lisp/org.el

+ 7 - 0
lisp/ChangeLog

@@ -1,5 +1,12 @@
 2009-02-20  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-remember.el (org-remember-apply-template): Use
+	`org-completing-read-no-ido'.
+
+	* org.el (org-completing-read-no-ido): New function.
+	(org-make-tags-matcher, org-set-property): Use
+	`org-completing-read-no-ido'.
+
 	* org-export-latex.el (org-export-latex-import-inbuffer-stuff):
 	New option.
 	(org-export-as-latex): Import in-buffer settings as TeX macros.

+ 2 - 2
lisp/org-remember.el

@@ -538,7 +538,7 @@ to be run from that hook to function properly."
 			   propprompt
 			   (mapcar 'list (org-split-string allowed "[ \t]+"))
 			   nil 'req-match)
-			(org-completing-read propprompt existing nil nil
+			(org-completing-read-no-ido propprompt existing nil nil
 					     "" nil ""))))
 	      (org-set-property prop val)))
 	   (char
@@ -551,7 +551,7 @@ to be run from that hook to function properly."
 				   nil nil (list org-end-time-was-given)))
 	   (t
 	    (let (org-completion-use-ido)
-	      (insert (org-completing-read
+	      (insert (org-completing-read-no-ido
 		       (concat (if prompt prompt "Enter string")
 			       (if default (concat " [" default "]"))
 			       ": ")

+ 11 - 6
lisp/org.el

@@ -7043,6 +7043,10 @@ used as the link location instead of reading one interactively."
     (org-defkey minibuffer-local-completion-map "?" 'self-insert-command)
     (apply 'org-ido-completing-read args)))
 
+(defun org-completing-read-no-ido (&rest args)
+  (let (org-completion-use-ido)
+    (apply 'org-completing-read args)))
+
 (defun org-ido-completing-read (&rest args)
   "Completing-read using `ido-mode' speedups if available"
   (if (and org-completion-use-ido
@@ -9838,7 +9842,7 @@ also TODO lines."
     ;; Get a new match request, with completion
     (let ((org-last-tags-completion-table
 	   (org-global-tags-completion-table)))
-      (setq match (org-completing-read
+      (setq match (org-completing-read-no-ido
 		   "Match: " 'org-tags-completion-function nil nil nil
 		   'org-tags-history))))
 
@@ -11082,11 +11086,12 @@ in the current file."
 	  (existing (mapcar 'list (org-property-values prop)))
 	  (val (if allowed
 		   (org-completing-read "Value: " allowed nil 'req-match)
-		 (org-completing-read
-		  (concat "Value" (if (and cur (string-match "\\S-" cur))
-				      (concat "[" cur "]") "")
-			  ": ")
-		  existing nil nil "" nil cur))))
+		 (let (org-completion-use-ido)
+		   (org-completing-read
+		    (concat "Value" (if (and cur (string-match "\\S-" cur))
+					(concat "[" cur "]") "")
+			    ": ")
+		    existing nil nil "" nil cur)))))
      (list prop (if (equal val "") cur val))))
   (unless (equal (org-entry-get nil property) value)
     (org-entry-put nil property value)))