Function: ido-make-prompt

ido-make-prompt is a byte-compiled function defined in ido.el.gz.

Signature

(ido-make-prompt ITEM PROMPT)

Source Code

;; Defined in /usr/src/emacs/lisp/ido.el.gz
(defun ido-make-prompt (item prompt)
  ;; Make the prompt for ido-read-internal
  (cond
   ((and (memq item '(file dir)) ido-current-directory)
    (let ((dirname (abbreviate-file-name ido-current-directory))
	  (max-width (if (and ido-max-file-prompt-width (floatp ido-max-file-prompt-width))
			 (floor (* (frame-width) ido-max-file-prompt-width))
		       ido-max-file-prompt-width))
	  (literal (and (boundp 'ido-find-literal) ido-find-literal "(literal) "))
	  (vc-off (and ido-saved-vc-hb (not vc-handled-backends) "[-VC] "))
	  ;; (prefix nil)
	  (rule ido-rewrite-file-prompt-rules))
      (let ((case-fold-search nil))
	(while rule
	  (if (and (consp (car rule))
		   (string-match (car (car rule)) dirname))
	      (setq dirname
		    (if (stringp (cdr (car rule)))
			(replace-match (cdr (car rule)) t nil dirname)
		      (funcall (cdr (car rule)) dirname))))
	  (setq rule (cdr rule))))
      (run-hooks 'ido-rewrite-file-prompt-functions)
      (concat prompt
	      ; (if ido-process-ignore-lists "" "&")
	      (or literal "")
	      (or vc-off  "")
	      ;; (or prefix "")
	      (let ((l (length dirname)))
		(if (and max-width (> max-width 0) (> l max-width))
		    (let* ((s (substring dirname (- max-width)))
			   (i (string-search "/" s)))
		      (concat "..." (if i (substring s i) s)))
		  dirname)))))
   (t prompt)))