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."
(let* ((completion-ignore-case nil)
(completion-ignored-extensions comint-completion-fignore)
(success t)
(filename (or (comint-match-partial-filename) ""))
(pathdir (file-name-directory filename))
(pathnondir (file-name-nondirectory filename))
(directory (if pathdir (comint-directory pathdir) default-directory))
(completion (file-name-completion pathnondir directory)))
(filename (comint-match-partial-filename))
endpos pathdir pathnondir directory completion)
(setq endpos (if filename (match-end 0) (point)))
(or filename (setq filename ""))
(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)
(message "No completions of %s" filename)
(setq success nil))
......@@ -1851,7 +1854,7 @@ See `comint-dynamic-complete-filename'. Returns t if successful."
(t ; Completion string returned.
(let ((file (concat (file-name-as-directory directory) completion)))
(goto-char (match-end 0))
(goto-char endpos)
(insert (substring (directory-file-name completion)
(length pathnondir)))
(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