comint-get-source

comint-get-source is a compiled Lisp function in `comint.el'.

(comint-get-source PROMPT PREV-DIR/FILE SOURCE-MODES MUSTMATCH-P)

Prompt for filenames in commands that process source files,
e.g. loading or compiling a file.
Provides a default, if there is one, and returns the result filename.

See `comint-source-default' for more on determining defaults.

PROMPT is the prompt string. PREV-DIR/FILE is the (DIRECTORY . FILE) pair
from the last source processing command. SOURCE-MODES is a list of major
modes used to determine what file buffers contain source files. (These
two arguments are used for determining defaults.) If MUSTMATCH-P is true,
then the filename reader will only accept a file that exists.

A typical use:
(interactive (comint-get-source "Compile file: " prev-lisp-dir/file
'(lisp-mode) t))