Pārlūkot izejas kodu

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 17 gadi atpakaļ
vecāks
revīzija
3c121459b4
3 mainītis faili ar 20 papildinājumiem un 8 dzēšanām
  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>
 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):
 	* org-export-latex.el (org-export-latex-import-inbuffer-stuff):
 	New option.
 	New option.
 	(org-export-as-latex): Import in-buffer settings as TeX macros.
 	(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
 			   propprompt
 			   (mapcar 'list (org-split-string allowed "[ \t]+"))
 			   (mapcar 'list (org-split-string allowed "[ \t]+"))
 			   nil 'req-match)
 			   nil 'req-match)
-			(org-completing-read propprompt existing nil nil
+			(org-completing-read-no-ido propprompt existing nil nil
 					     "" nil ""))))
 					     "" nil ""))))
 	      (org-set-property prop val)))
 	      (org-set-property prop val)))
 	   (char
 	   (char
@@ -551,7 +551,7 @@ to be run from that hook to function properly."
 				   nil nil (list org-end-time-was-given)))
 				   nil nil (list org-end-time-was-given)))
 	   (t
 	   (t
 	    (let (org-completion-use-ido)
 	    (let (org-completion-use-ido)
-	      (insert (org-completing-read
+	      (insert (org-completing-read-no-ido
 		       (concat (if prompt prompt "Enter string")
 		       (concat (if prompt prompt "Enter string")
 			       (if default (concat " [" default "]"))
 			       (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)
     (org-defkey minibuffer-local-completion-map "?" 'self-insert-command)
     (apply 'org-ido-completing-read args)))
     (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)
 (defun org-ido-completing-read (&rest args)
   "Completing-read using `ido-mode' speedups if available"
   "Completing-read using `ido-mode' speedups if available"
   (if (and org-completion-use-ido
   (if (and org-completion-use-ido
@@ -9838,7 +9842,7 @@ also TODO lines."
     ;; Get a new match request, with completion
     ;; Get a new match request, with completion
     (let ((org-last-tags-completion-table
     (let ((org-last-tags-completion-table
 	   (org-global-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
 		   "Match: " 'org-tags-completion-function nil nil nil
 		   'org-tags-history))))
 		   'org-tags-history))))
 
 
@@ -11082,11 +11086,12 @@ in the current file."
 	  (existing (mapcar 'list (org-property-values prop)))
 	  (existing (mapcar 'list (org-property-values prop)))
 	  (val (if allowed
 	  (val (if allowed
 		   (org-completing-read "Value: " allowed nil 'req-match)
 		   (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))))
      (list prop (if (equal val "") cur val))))
   (unless (equal (org-entry-get nil property) value)
   (unless (equal (org-entry-get nil property) value)
     (org-entry-put nil property value)))
     (org-entry-put nil property value)))