aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/ido.el
diff options
context:
space:
mode:
authorKim F. Storm <[email protected]>2002-07-07 23:02:54 +0000
committerKim F. Storm <[email protected]>2002-07-07 23:02:54 +0000
commit030fa15b8f9f8649d957be83ecd92c52ec08b798 (patch)
tree70d6ad57f1973002a5d5edf5f8d2b2bbe22be9ac /lisp/ido.el
parentfb3fff88d2a881b08d74005efe7c0061e6d2b6c4 (diff)
(ido-set-matches1): Use regexp-quote instead of identity.
(ido-complete-space): New function. (ido-define-mode-map): Bind it to SPACE.
Diffstat (limited to 'lisp/ido.el')
-rw-r--r--lisp/ido.el24
1 files changed, 23 insertions, 1 deletions
diff --git a/lisp/ido.el b/lisp/ido.el
index 446a1239a9..4d9bed04f8 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -1256,6 +1256,7 @@ This function also adds a hook to the minibuffer."
(define-key map "\C-c" 'ido-toggle-case)
(define-key map "\C-e" 'ido-edit-input)
(define-key map "\t" 'ido-complete)
+ (define-key map " " 'ido-complete-space)
(define-key map "\C-j" 'ido-select-text)
(define-key map "\C-m" 'ido-exit-minibuffer)
(define-key map "\C-p" 'ido-toggle-prefix)
@@ -1942,6 +1943,27 @@ If INITIAL is non-nil, it specifies the initial input string."
(ido-completion-help)
)))))
+(defun ido-complete-space ()
+ "Try completion unless inserting the space makes sense."
+ (interactive)
+ (if (and (stringp ido-common-match-string)
+ (stringp ido-text)
+ (cond
+ ((> (length ido-common-match-string) (length ido-text))
+ (= (aref ido-common-match-string (length ido-text)) ? ))
+ (ido-matches
+ (let (insert-space
+ (re (concat (regexp-quote ido-text) " "))
+ (comp ido-matches))
+ (while comp
+ (if (string-match re (ido-name (car comp)))
+ (setq comp nil insert-space t)
+ (setq comp (cdr comp))))
+ insert-space))
+ (t nil)))
+ (insert " ")
+ (ido-complete)))
+
(defun ido-undo-merge-work-directory (&optional text try refresh)
"Undo or redo last ido directory merge operation.
If no merge has yet taken place, toggle automatic merging option."
@@ -2729,7 +2751,7 @@ for first matching file."
ido-enable-flex-matching
(> (length ido-text) 1)
(not ido-enable-regexp))
- (setq re (mapconcat 'identity (split-string ido-text "") ".*"))
+ (setq re (mapconcat 'regexp-quote (split-string ido-text "") ".*"))
(if ido-enable-prefix
(setq re (concat "\\`" re)))
(mapcar