* lisp/wid-edit.el (file widget): Add a :match and a :validate
function to the 'file widget, to be able to check if the widget
value is an existent file, when required (bug#25678).
:completions (completion-table-case-fold
#'completion-file-name-table
(not read-file-name-completion-ignore-case))
+ :match (lambda (widget value)
+ (or (not (widget-get widget :must-match))
+ (file-exists-p value)))
+ :validate (lambda (widget)
+ (let ((value (widget-value widget)))
+ (unless (widget-apply widget :match value)
+ (widget-put widget
+ :error (format "File %s does not exist" value))
+ widget)))
:prompt-value 'widget-file-prompt-value
:format "%{%t%}: %v"
;; Doesn't work well with terminating newline.