Function: viper-ex-read-file-name

viper-ex-read-file-name is a byte-compiled function defined in viper-ex.el.gz.

Signature

(viper-ex-read-file-name PROMPT)

Source Code

;; Defined in /usr/src/emacs/lisp/emulation/viper-ex.el.gz
;; Read file name from the minibuffer in an ex command.
;; If user doesn't enter anything, then "" is returned, i.e., the
;; prompt-directory is not returned.
(defun viper-ex-read-file-name (prompt)
  (let* ((str "")
	 (minibuffer-local-completion-map
	  (copy-keymap minibuffer-local-completion-map))
	 beg end cont val)

    (viper-add-keymap ex-read-filename-map minibuffer-local-completion-map)

    (setq cont (setq viper-keep-reading-filename t))
    (while cont
      (setq viper-keep-reading-filename nil
	    val (read-file-name (concat prompt str) nil default-directory))
      (setq val (expand-file-name val))
      (if (and (string-search " " val)
	       (ex-cmd-accepts-multiple-files-p ex-token))
	  (setq val (concat "\"" val "\"")))
      (setq str  (concat str (if (equal val "") "" " ")
			 val (if (equal val "") "" " ")))

      ;; Only edit, next, and Next commands accept multiple files.
      ;; viper-keep-reading-filename is set in the anonymous function that is
      ;; bound to " " in ex-read-filename-map.
      (setq cont (and viper-keep-reading-filename
		      (ex-cmd-accepts-multiple-files-p ex-token)))
      )

    (setq beg (string-match "[^ \t]" str)   ; delete leading blanks
	  end (string-match "[ \t]*$" str)) ; delete trailing blanks
    (if (member ex-token '("read" "write"))
	  (if (string-match "[\t ]*!" str)
	      ;; this is actually a shell command
	      (progn
		(setq ex-cmdfile t)
		(setq beg (1+ beg))
		(setq viper-last-ex-prompt
		      (concat viper-last-ex-prompt " !")))))
    (substring str (or beg 0) end)))