Mercurial > emacs
changeset 46231:794e46e1c313
(ido-set-matches1): Use regexp-quote instead of identity.
(ido-complete-space): New function.
(ido-define-mode-map): Bind it to SPACE.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Sun, 07 Jul 2002 23:02:54 +0000 |
parents | 4ae4485ac972 |
children | c4de1416e022 |
files | lisp/ido.el |
diffstat | 1 files changed, 23 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ido.el Sun Jul 07 23:01:21 2002 +0000 +++ b/lisp/ido.el Sun Jul 07 23:02:54 2002 +0000 @@ -1256,6 +1256,7 @@ (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 @@ (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 @@ 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