Function: todo-read-file-name

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

Signature

(todo-read-file-name PROMPT &optional ARCHIVE MUSTMATCH)

Documentation

Choose and return the name of a todo file, prompting with PROMPT.

Show completions with TAB or SPC; the names are shown in short form but the absolute truename is returned. With non-nil ARCHIVE return the absolute truename of a todo archive file. With non-nil MUSTMATCH the name of an existing file must be chosen; otherwise, a new file name is allowed.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/todo-mode.el.gz
(defun todo-read-file-name (prompt &optional archive mustmatch)
  "Choose and return the name of a todo file, prompting with PROMPT.

Show completions with TAB or SPC; the names are shown in short
form but the absolute truename is returned.  With non-nil ARCHIVE
return the absolute truename of a todo archive file.  With non-nil
MUSTMATCH the name of an existing file must be chosen;
otherwise, a new file name is allowed."
  (let* ((completion-ignore-case todo-completion-ignore-case)
	 (files (mapcar #'todo-short-file-name
			;; (funcall todo-files-function archive)))
			(if archive todo-archives todo-files)))
	 (file (completing-read prompt files nil mustmatch nil nil
				(if files
				    ;; If user hit RET without
				    ;; choosing a file, default to
				    ;; current or default file.
				    (todo-short-file-name
				     (or todo-current-todo-file
					 (and todo-show-current-file
					      todo-global-current-todo-file)
					 (todo-absolute-file-name
					  todo-default-todo-file)))
				  ;; Trigger prompt for initial file.
				  ""))))
    (unless (file-exists-p todo-directory)
      (make-directory todo-directory))
    (unless (or mustmatch (member file files))
      (setq file (todo-validate-name file 'file)))
    (setq file (file-truename (concat todo-directory file
				      (if archive ".toda" ".todo"))))))