aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim F. Storm2002-07-07 23:02:54 +0000
committerKim F. Storm2002-07-07 23:02:54 +0000
commit030fa15b8f9f8649d957be83ecd92c52ec08b798 (patch)
tree70d6ad57f1973002a5d5edf5f8d2b2bbe22be9ac
parentfb3fff88d2a881b08d74005efe7c0061e6d2b6c4 (diff)
downloademacs-030fa15b8f9f8649d957be83ecd92c52ec08b798.tar.gz
emacs-030fa15b8f9f8649d957be83ecd92c52ec08b798.zip
(ido-set-matches1): Use regexp-quote instead of identity.
(ido-complete-space): New function. (ido-define-mode-map): Bind it to SPACE.
-rw-r--r--lisp/ido.el24
1 files changed, 23 insertions, 1 deletions
diff --git a/lisp/ido.el b/lisp/ido.el
index 446a1239a9f..4d9bed04f8d 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -1256,6 +1256,7 @@ This function also adds a hook to the minibuffer."
1256 (define-key map "\C-c" 'ido-toggle-case) 1256 (define-key map "\C-c" 'ido-toggle-case)
1257 (define-key map "\C-e" 'ido-edit-input) 1257 (define-key map "\C-e" 'ido-edit-input)
1258 (define-key map "\t" 'ido-complete) 1258 (define-key map "\t" 'ido-complete)
1259 (define-key map " " 'ido-complete-space)
1259 (define-key map "\C-j" 'ido-select-text) 1260 (define-key map "\C-j" 'ido-select-text)
1260 (define-key map "\C-m" 'ido-exit-minibuffer) 1261 (define-key map "\C-m" 'ido-exit-minibuffer)
1261 (define-key map "\C-p" 'ido-toggle-prefix) 1262 (define-key map "\C-p" 'ido-toggle-prefix)
@@ -1942,6 +1943,27 @@ If INITIAL is non-nil, it specifies the initial input string."
1942 (ido-completion-help) 1943 (ido-completion-help)
1943 ))))) 1944 )))))
1944 1945
1946(defun ido-complete-space ()
1947 "Try completion unless inserting the space makes sense."
1948 (interactive)
1949 (if (and (stringp ido-common-match-string)
1950 (stringp ido-text)
1951 (cond
1952 ((> (length ido-common-match-string) (length ido-text))
1953 (= (aref ido-common-match-string (length ido-text)) ? ))
1954 (ido-matches
1955 (let (insert-space
1956 (re (concat (regexp-quote ido-text) " "))
1957 (comp ido-matches))
1958 (while comp
1959 (if (string-match re (ido-name (car comp)))
1960 (setq comp nil insert-space t)
1961 (setq comp (cdr comp))))
1962 insert-space))
1963 (t nil)))
1964 (insert " ")
1965 (ido-complete)))
1966
1945(defun ido-undo-merge-work-directory (&optional text try refresh) 1967(defun ido-undo-merge-work-directory (&optional text try refresh)
1946 "Undo or redo last ido directory merge operation. 1968 "Undo or redo last ido directory merge operation.
1947If no merge has yet taken place, toggle automatic merging option." 1969If no merge has yet taken place, toggle automatic merging option."
@@ -2729,7 +2751,7 @@ for first matching file."
2729 ido-enable-flex-matching 2751 ido-enable-flex-matching
2730 (> (length ido-text) 1) 2752 (> (length ido-text) 1)
2731 (not ido-enable-regexp)) 2753 (not ido-enable-regexp))
2732 (setq re (mapconcat 'identity (split-string ido-text "") ".*")) 2754 (setq re (mapconcat 'regexp-quote (split-string ido-text "") ".*"))
2733 (if ido-enable-prefix 2755 (if ido-enable-prefix
2734 (setq re (concat "\\`" re))) 2756 (setq re (concat "\\`" re)))
2735 (mapcar 2757 (mapcar