Pass unquoted filename to user-supplied MUSTMATCH predicate
* lisp/minibuffer.el (read-file-name-default): Pass REQUIRE-MATCH argument through substitute-in-file-name. * lisp/minibuffer.el (read-file-name): Update docstring. Resolves bug#68815.
This commit is contained in:
parent
4749699370
commit
e25d11314d
1 changed files with 12 additions and 5 deletions
|
@ -3262,9 +3262,10 @@ Fourth arg MUSTMATCH can take the following values:
|
||||||
input, but she needs to confirm her choice if she called
|
input, but she needs to confirm her choice if she called
|
||||||
`minibuffer-complete' right before `minibuffer-complete-and-exit'
|
`minibuffer-complete' right before `minibuffer-complete-and-exit'
|
||||||
and the input is not an existing file.
|
and the input is not an existing file.
|
||||||
- a function, which will be called with the input as the
|
- a function, which will be called with a single argument, the
|
||||||
argument. If the function returns a non-nil value, the
|
input unquoted by `substitute-in-file-name', which see. If the
|
||||||
minibuffer is exited with that argument as the value.
|
function returns a non-nil value, the minibuffer is exited with
|
||||||
|
that argument as the value.
|
||||||
- anything else behaves like t except that typing RET does not exit if it
|
- anything else behaves like t except that typing RET does not exit if it
|
||||||
does non-null completion.
|
does non-null completion.
|
||||||
|
|
||||||
|
@ -3353,7 +3354,13 @@ See `read-file-name' for the meaning of the arguments."
|
||||||
(let ((ignore-case read-file-name-completion-ignore-case)
|
(let ((ignore-case read-file-name-completion-ignore-case)
|
||||||
(minibuffer-completing-file-name t)
|
(minibuffer-completing-file-name t)
|
||||||
(pred (or predicate 'file-exists-p))
|
(pred (or predicate 'file-exists-p))
|
||||||
(add-to-history nil))
|
(add-to-history nil)
|
||||||
|
(require-match (if (functionp mustmatch)
|
||||||
|
(lambda (input)
|
||||||
|
(funcall mustmatch
|
||||||
|
;; User-supplied MUSTMATCH expects an unquoted filename
|
||||||
|
(substitute-in-file-name input)))
|
||||||
|
mustmatch)))
|
||||||
|
|
||||||
(let* ((val
|
(let* ((val
|
||||||
(if (or (not (next-read-file-uses-dialog-p))
|
(if (or (not (next-read-file-uses-dialog-p))
|
||||||
|
@ -3389,7 +3396,7 @@ See `read-file-name' for the meaning of the arguments."
|
||||||
(read-file-name--defaults dir initial))))
|
(read-file-name--defaults dir initial))))
|
||||||
(set-syntax-table minibuffer-local-filename-syntax))
|
(set-syntax-table minibuffer-local-filename-syntax))
|
||||||
(completing-read prompt 'read-file-name-internal
|
(completing-read prompt 'read-file-name-internal
|
||||||
pred mustmatch insdef
|
pred require-match insdef
|
||||||
'file-name-history default-filename)))
|
'file-name-history default-filename)))
|
||||||
;; If DEFAULT-FILENAME not supplied and DIR contains
|
;; If DEFAULT-FILENAME not supplied and DIR contains
|
||||||
;; a file name, split it.
|
;; a file name, split it.
|
||||||
|
|
Loading…
Add table
Reference in a new issue