Function: emerge-read-file-name

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

Signature

(emerge-read-file-name PROMPT ALTERNATIVE-DEFAULT-DIR DEFAULT-FILE A-FILE MUST-MATCH)

Source Code

;; Defined in /usr/src/emacs/lisp/vc/emerge.el.gz
;; Read a file name, handling all of the various defaulting rules.

(defun emerge-read-file-name (prompt alternative-default-dir default-file
			      A-file must-match)
  ;; `prompt' should not have trailing ": ", so that it can be modified
  ;; according to context.
  ;; If alternative-default-dir is non-nil, it should be used as the default
  ;; directory instead if default-directory, if emerge-default-last-directories
  ;; is set.
  ;; If default-file is set, it should be used as the default value.
  ;; If A-file is set, and its directory is different from
  ;; alternative-default-dir, and if emerge-default-last-directories is set,
  ;; the default file should be the last part of A-file in the default
  ;; directory.  (Overriding default-file.)
  (cond
   ;; If this is not the A-file argument (shown by non-nil A-file), and
   ;; if emerge-default-last-directories is set, and
   ;; the default directory exists but is not the same as the directory of the
   ;; A-file,
   ;; then make the default file have the same name as the A-file, but in
   ;; the default directory.
   ((and emerge-default-last-directories
	 A-file
	 alternative-default-dir
	 (not (string-equal alternative-default-dir
			    (file-name-directory A-file))))
    (read-file-name (format-prompt prompt (file-name-nondirectory A-file))
		    alternative-default-dir
		    (concat alternative-default-dir
			    (file-name-nondirectory A-file))
		    (and must-match 'confirm)))
   ;; If there is a default file, use it.
   (default-file
     (read-file-name (format-prompt prompt default-file)
		     ;; If emerge-default-last-directories is set, use the
		     ;; directory from the same argument of the last call of
		     ;; Emerge as the default for this argument.
		     (and emerge-default-last-directories
			  alternative-default-dir)
		     default-file (and must-match 'confirm)))
   (t
    (read-file-name (concat prompt ": ")
		    ;; If emerge-default-last-directories is set, use the
		    ;; directory from the same argument of the last call of
		    ;; Emerge as the default for this argument.
		    (and emerge-default-last-directories
			 alternative-default-dir)
		    nil (and must-match 'confirm)))))