Commit ca600722 authored by Karl Heuer's avatar Karl Heuer

(comint-dynamic-complete-as-filename): Save end of match before calling other

functions.  Handle non-match too.
parent 5d831bed
...@@ -1836,11 +1836,14 @@ See `comint-dynamic-complete-filename'. Returns t if successful." ...@@ -1836,11 +1836,14 @@ See `comint-dynamic-complete-filename'. Returns t if successful."
(let* ((completion-ignore-case nil) (let* ((completion-ignore-case nil)
(completion-ignored-extensions comint-completion-fignore) (completion-ignored-extensions comint-completion-fignore)
(success t) (success t)
(filename (or (comint-match-partial-filename) "")) (filename (comint-match-partial-filename))
(pathdir (file-name-directory filename)) endpos pathdir pathnondir directory completion)
(pathnondir (file-name-nondirectory filename)) (setq endpos (if filename (match-end 0) (point)))
(directory (if pathdir (comint-directory pathdir) default-directory)) (or filename (setq filename ""))
(completion (file-name-completion pathnondir directory))) (setq pathdir (file-name-directory filename)
pathnondir (file-name-nondirectory filename)
directory (if pathdir (comint-directory pathdir) default-directory)
completion (file-name-completion pathnondir directory))
(cond ((null completion) (cond ((null completion)
(message "No completions of %s" filename) (message "No completions of %s" filename)
(setq success nil)) (setq success nil))
...@@ -1851,7 +1854,7 @@ See `comint-dynamic-complete-filename'. Returns t if successful." ...@@ -1851,7 +1854,7 @@ See `comint-dynamic-complete-filename'. Returns t if successful."
(comint-dynamic-list-filename-completions)) (comint-dynamic-list-filename-completions))
(t ; Completion string returned. (t ; Completion string returned.
(let ((file (concat (file-name-as-directory directory) completion))) (let ((file (concat (file-name-as-directory directory) completion)))
(goto-char (match-end 0)) (goto-char endpos)
(insert (substring (directory-file-name completion) (insert (substring (directory-file-name completion)
(length pathnondir))) (length pathnondir)))
(cond ((symbolp (file-name-completion completion directory)) (cond ((symbolp (file-name-completion completion directory))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment