(let* ((pathname (comint-match-partial-pathname))
(pathdir (file-name-directory pathname))
(pathnondir (file-name-nondirectory pathname))
- (completion (file-name-completion pathnondir
- (or pathdir default-directory))))
+ (completion (file-name-completion
+ pathnondir
+ ;; It is important to expand PATHDIR because
+ ;; default-directory might be a handled name, and the
+ ;; unexpanded PATHDIR won't necessarily match the
+ ;; handler regexp.
+ (if pathdir
+ (expand-file-name pathdir)
+ default-directory))))
(cond ((null completion)
(message "No completions of %s" pathname)
(ding))