Replace file-name-as-directory with file-name-directory,
because file-name-as-directory returns a nonexistent dir
e.g. "/dir/prefix/" when completing "/dir/prefix".
OTOH, file-name-directory returns "/dir/" in such cases (bug#55743).
;; - With fancy completion styles, the code below will not always
;; find the right base directory.
(if minibuffer-completing-file-name
- (file-name-as-directory
+ (file-name-directory
(expand-file-name
(buffer-substring (minibuffer-prompt-end) (point)))))))
(with-current-buffer standard-output