Function: ido-exhibit
ido-exhibit is a byte-compiled function defined in ido.el.gz.
Signature
(ido-exhibit)
Documentation
Post command hook for Ido.
Source Code
;; Defined in /usr/src/emacs/lisp/ido.el.gz
(defun ido-exhibit ()
"Post command hook for Ido."
;; Find matching files and display a list in the minibuffer.
;; Copied from `icomplete-exhibit' with two changes:
;; 1. It prints a default file name when there is no text yet entered.
;; 2. It calls my completion routine rather than the standard completion.
(when (ido-active)
(let ((contents (buffer-substring-no-properties (minibuffer-prompt-end) (point-max)))
(buffer-undo-list t)
try-single-dir-match
refresh)
(when ido-trace-enable
(ido-trace "\nexhibit" this-command)
(ido-trace "dir" ido-current-directory)
(ido-trace "contents" contents)
(ido-trace "list" ido-cur-list)
(ido-trace "matches" ido-matches)
(ido-trace "rescan" ido-rescan))
(save-excursion
(goto-char (point-max))
;; Register the end of input, so we know where the extra stuff (match-status info) begins:
(unless (boundp 'ido-eoinput)
;; In case it got wiped out by major mode business:
(make-local-variable 'ido-eoinput))
(setq ido-eoinput (point))
;; Handle explicit directory changes
(cond
((memq ido-cur-item '(buffer list))
)
((= (length contents) 0)
)
((= (length contents) 1)
(cond
((and (ido-is-tramp-root) (string-equal contents "/"))
(ido-set-current-directory ido-current-directory contents)
(setq refresh t))
((and (ido-unc-hosts) (string-equal contents "/")
(let ((ido-enable-tramp-completion nil))
(ido-is-root-directory)))
(ido-set-current-directory "//")
(setq refresh t))
))
((and (string-match (if ido-enable-tramp-completion ".[:@]\\'" ".:\\'") contents)
(ido-is-root-directory) ;; Ange-ftp or tramp
(not (ido-local-file-exists-p contents)))
(ido-set-current-directory ido-current-directory contents)
(when (ido-is-slow-ftp-host)
(setq ido-exit 'fallback)
(exit-minibuffer))
(setq refresh t))
((ido-final-slash contents) ;; xxx/
(ido-trace "final slash" contents)
(cond
((string-equal contents "~/")
(ido-set-current-home)
(setq refresh t))
((string-equal contents "../")
(ido-up-directory t)
(setq refresh t))
((string-equal contents "./")
(setq refresh t))
((string-match "\\`~[-_a-zA-Z0-9]+[$]?/\\'" contents)
(ido-trace "new home" contents)
(ido-set-current-home contents)
(setq refresh t))
((string-match "[$][A-Za-z0-9_]+/\\'" contents)
(let ((exp (condition-case ()
(expand-file-name
(substitute-in-file-name (substring contents 0 -1))
ido-current-directory)
(error nil))))
(ido-trace contents exp)
(when (and exp (file-directory-p exp))
(ido-set-current-directory (file-name-directory exp))
(setq ido-text-init (file-name-nondirectory exp))
(setq refresh t))))
((and (memq system-type '(windows-nt ms-dos))
(string-equal (substring contents 1) ":/"))
(ido-set-current-directory (file-name-directory contents))
(setq refresh t))
((string-equal (substring contents -2 -1) "/")
(ido-set-current-directory
(if (memq system-type '(windows-nt ms-dos))
(expand-file-name "/" ido-current-directory)
"/"))
(setq refresh t))
((and (or ido-directory-nonreadable ido-directory-too-big)
(file-directory-p (concat ido-current-directory (file-name-directory contents))))
(ido-set-current-directory
(concat ido-current-directory (file-name-directory contents)))
(setq refresh t))
(t
(ido-trace "try single dir")
(setq try-single-dir-match t))))
((and (string-equal (substring contents -2 -1) "/")
(not (string-search "$" contents)))
(ido-set-current-directory
(cond
((= (length contents) 2)
"/")
(ido-matches
(concat ido-current-directory (ido-name (car ido-matches))))
(t
(concat ido-current-directory (substring contents 0 -1)))))
(setq ido-text-init (substring contents -1))
(setq refresh t))
((and (not ido-use-merged-list)
(not (ido-final-slash contents))
(eq ido-try-merged-list t)
(numberp ido-auto-merge-work-directories-length)
(> ido-auto-merge-work-directories-length 0)
(= (length contents) ido-auto-merge-work-directories-length)
(not (and ido-auto-merge-inhibit-characters-regexp
(string-match ido-auto-merge-inhibit-characters-regexp contents)))
(not (input-pending-p)))
(setq ido-use-merged-list 'auto
ido-text-init contents
ido-rotate-temp t)
(setq refresh t))
(t nil))
(when refresh
(ido-trace "refresh on /" ido-text-init)
(setq ido-exit 'refresh)
(exit-minibuffer))
(when (and ido-enter-matching-directory
ido-matches
(or (eq ido-enter-matching-directory 'first)
(null (cdr ido-matches)))
(ido-final-slash (ido-name (car ido-matches)))
(or try-single-dir-match
(eq ido-enter-matching-directory t)))
(ido-trace "single match" (car ido-matches))
(ido-set-current-directory
(concat ido-current-directory (ido-name (car ido-matches))))
(setq ido-exit 'refresh)
(exit-minibuffer))
;; Update the list of matches
(setq ido-text contents)
(ido-set-matches)
(ido-trace "new " ido-matches)
(when (and (boundp 'ido-enable-virtual-buffers)
(not (eq ido-enable-virtual-buffers 'always))
(eq ido-cur-item 'buffer)
(eq ido-use-virtual-buffers 'auto))
(when (and (not ido-enable-virtual-buffers)
(not ido-matches))
(setq ido-text-init ido-text)
(setq ido-enable-virtual-buffers t)
(setq ido-exit 'refresh)
(exit-minibuffer))
;; If input matches real buffers turn off virtual buffers.
(when (and ido-enable-virtual-buffers
ido-matches
(ido-set-matches-1 (ido-make-buffer-list-1)))
(setq ido-enable-virtual-buffers nil)
(setq ido-text-init ido-text)
(setq ido-exit 'refresh)
(exit-minibuffer)))
(when (and (not ido-matches)
(not ido-directory-nonreadable)
(not ido-directory-too-big)
;; ido-rescan ?
ido-process-ignore-lists
ido-ignored-list)
(let ((ido-process-ignore-lists nil)
(ido-rotate ido-rotate)
(ido-cur-list ido-ignored-list))
(ido-trace "try all" ido-ignored-list)
(ido-set-matches))
(when ido-matches
(ido-trace "found " ido-matches)
(setq ido-rescan t)
(setq ido-process-ignore-lists-inhibit t)
(setq ido-text-init ido-text)
(setq ido-exit 'refresh)
(exit-minibuffer)))
(when (and
ido-rescan
(not ido-matches)
(memq ido-cur-item '(file dir))
(not (ido-is-root-directory))
(> (length contents) 1)
(not (string-search "$" contents))
(not ido-directory-nonreadable)
(not ido-directory-too-big))
(ido-trace "merge?")
(if ido-use-merged-list
(ido-undo-merge-work-directory contents nil)
(when (and (eq ido-try-merged-list t)
(numberp ido-auto-merge-work-directories-length)
(= ido-auto-merge-work-directories-length 0)
(not (and ido-auto-merge-inhibit-characters-regexp
(string-match ido-auto-merge-inhibit-characters-regexp contents)))
(not (input-pending-p)))
(ido-trace "\n*start timer*")
(setq ido-auto-merge-timer
(run-with-timer ido-auto-merge-delay-time nil
#'ido-initiate-auto-merge
(current-buffer))))))
(setq ido-rescan t)
(if (and ido-use-merged-list
ido-matches
(not (string-equal (car (cdr (car ido-matches))) ido-current-directory)))
(progn
(ido-set-current-directory (car (cdr (car ido-matches))))
(setq ido-use-merged-list t
ido-exit 'keep
ido-text-init ido-text)
(exit-minibuffer)))
;; Insert the match-status information:
(ido-set-common-completion)
(let ((inf (ido-completions contents)))
(setq ido-show-confirm-message nil)
(ido-trace "inf" inf)
(let ((pos (point)))
(insert inf)
(if (< pos (point-max))
;; Tell set-minibuffer-message where to display the
;; overlay with temporary messages.
(put-text-property pos (1+ pos) 'minibuffer-message t)))
)
))))