When specifying a customizable variable foo-paths as follows:

(defcustom foo-paths nil
  "Paths for foo-related things."
  :group 'foo
  :options '(foo-1 foo-2)
  :type '(alist :key-type symbol :value-type (file :must-match t)))

There doesn't seem to be any enforcement of the value type in the Customize interface. I can enter any text I want for the values, not just a file (let alone an existing file).

Am I missing something here? The manual says:

(file :must-match t)

The value must be a file name for an existing file. The widget provides completion.

What completion is the widget providing? I don't see any; all I see is a plain text box.

I'm using Emacs 25.1.1.

  • (Quick response; no time.) Use M-TAB (or ESC TAB) to complete a partial file name that you type. I think you're right that the :must-match doesn't seem to do what one would expect - completion seems to be lax, not strict. And yet the code (for widget-file-prompt-value) does use (read-file-name prompt2 dir nil must-match file), where must-match is non-nil. Seems like a bug, but likely someone else here will speak better to this. – Drew Feb 10 '17 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.