Mercurial > emacs
comparison lisp/ido.el @ 75381:3e93f595966f
(ido-active): Add xemacs test from ido-minibuffer-setup.
(ido-initiate-auto-merge, ido-exhibit, ido-minibuffer-setup)
(ido-tidy): Use ido-active.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Mon, 22 Jan 2007 22:37:25 +0000 |
parents | e3694f1cb928 |
children | 1859649395ed |
comparison
equal
deleted
inserted
replaced
75380:72942ec3e5e4 | 75381:3e93f595966f |
---|---|
1117 ;;; FUNCTIONS | 1117 ;;; FUNCTIONS |
1118 | 1118 |
1119 (defun ido-active (&optional merge) | 1119 (defun ido-active (&optional merge) |
1120 (if merge | 1120 (if merge |
1121 ido-use-merged-list | 1121 ido-use-merged-list |
1122 (and (boundp 'ido-completing-read) (= ido-use-mycompletion-depth (minibuffer-depth))))) | 1122 (and (boundp 'ido-completing-read) |
1123 (or (featurep 'xemacs) | |
1124 (= ido-use-mycompletion-depth (minibuffer-depth)))))) | |
1123 | 1125 |
1124 (defvar ido-trace-enable nil) | 1126 (defvar ido-trace-enable nil) |
1125 | 1127 |
1126 (defun ido-trace (p &optional s retval) | 1128 (defun ido-trace (p &optional s retval) |
1127 (if ido-trace-enable | 1129 (if ido-trace-enable |
4119 | 4121 |
4120 (defun ido-initiate-auto-merge (buffer) | 4122 (defun ido-initiate-auto-merge (buffer) |
4121 (ido-trace "\n*merge timeout*" buffer) | 4123 (ido-trace "\n*merge timeout*" buffer) |
4122 (setq ido-auto-merge-timer nil) | 4124 (setq ido-auto-merge-timer nil) |
4123 (when (and (buffer-live-p buffer) | 4125 (when (and (buffer-live-p buffer) |
4124 (= ido-use-mycompletion-depth (minibuffer-depth)) | 4126 (ido-active) |
4125 (boundp 'ido-eoinput) ido-eoinput) | 4127 (boundp 'ido-eoinput) ido-eoinput) |
4126 (let ((contents (buffer-substring-no-properties (minibuffer-prompt-end) ido-eoinput))) | 4128 (let ((contents (buffer-substring-no-properties (minibuffer-prompt-end) ido-eoinput))) |
4127 (ido-trace "request merge") | 4129 (ido-trace "request merge") |
4128 (setq ido-use-merged-list 'auto | 4130 (setq ido-use-merged-list 'auto |
4129 ido-text-init contents | 4131 ido-text-init contents |
4139 ;; Find matching files and display a list in the minibuffer. | 4141 ;; Find matching files and display a list in the minibuffer. |
4140 ;; Copied from `icomplete-exhibit' with two changes: | 4142 ;; Copied from `icomplete-exhibit' with two changes: |
4141 ;; 1. It prints a default file name when there is no text yet entered. | 4143 ;; 1. It prints a default file name when there is no text yet entered. |
4142 ;; 2. It calls my completion routine rather than the standard completion. | 4144 ;; 2. It calls my completion routine rather than the standard completion. |
4143 | 4145 |
4144 (when (= ido-use-mycompletion-depth (minibuffer-depth)) | 4146 (when (ido-active) |
4145 (let ((contents (buffer-substring-no-properties (minibuffer-prompt-end) (point-max))) | 4147 (let ((contents (buffer-substring-no-properties (minibuffer-prompt-end) (point-max))) |
4146 (buffer-undo-list t) | 4148 (buffer-undo-list t) |
4147 try-single-dir-match | 4149 try-single-dir-match |
4148 refresh) | 4150 refresh) |
4149 | 4151 |
4442 (nth 1 ido-decorations))))))) | 4444 (nth 1 ido-decorations))))))) |
4443 | 4445 |
4444 (defun ido-minibuffer-setup () | 4446 (defun ido-minibuffer-setup () |
4445 "Minibuffer setup hook for `ido'." | 4447 "Minibuffer setup hook for `ido'." |
4446 ;; Copied from `icomplete-minibuffer-setup-hook'. | 4448 ;; Copied from `icomplete-minibuffer-setup-hook'. |
4447 (when (and (boundp 'ido-completing-read) | 4449 (when (ido-active) |
4448 (or (featurep 'xemacs) | |
4449 (= ido-use-mycompletion-depth (minibuffer-depth)))) | |
4450 (add-hook 'pre-command-hook 'ido-tidy nil t) | 4450 (add-hook 'pre-command-hook 'ido-tidy nil t) |
4451 (add-hook 'post-command-hook 'ido-exhibit nil t) | 4451 (add-hook 'post-command-hook 'ido-exhibit nil t) |
4452 (setq cua-inhibit-cua-keys t) | 4452 (setq cua-inhibit-cua-keys t) |
4453 (when (featurep 'xemacs) | 4453 (when (featurep 'xemacs) |
4454 (ido-exhibit) | 4454 (ido-exhibit) |
4463 (when ido-auto-merge-timer | 4463 (when ido-auto-merge-timer |
4464 (ido-trace "\n*cancel timer*" this-command) | 4464 (ido-trace "\n*cancel timer*" this-command) |
4465 (cancel-timer ido-auto-merge-timer) | 4465 (cancel-timer ido-auto-merge-timer) |
4466 (setq ido-auto-merge-timer nil)) | 4466 (setq ido-auto-merge-timer nil)) |
4467 | 4467 |
4468 (if (and (boundp 'ido-use-mycompletion-depth) | 4468 (if (ido-active) |
4469 (= ido-use-mycompletion-depth (minibuffer-depth))) | |
4470 (if (and (boundp 'ido-eoinput) | 4469 (if (and (boundp 'ido-eoinput) |
4471 ido-eoinput) | 4470 ido-eoinput) |
4472 | 4471 |
4473 (if (> ido-eoinput (point-max)) | 4472 (if (> ido-eoinput (point-max)) |
4474 ;; Oops, got rug pulled out from under us - reinit: | 4473 ;; Oops, got rug pulled out from under us - reinit: |