diff options
author | Karl Heuer <kwzh@gnu.org> | 1994-04-11 20:30:44 +0000 |
---|---|---|
committer | Karl Heuer <kwzh@gnu.org> | 1994-04-11 20:30:44 +0000 |
commit | ca6007227294a1bea08d861f6d46a22e4993a0f2 (patch) | |
tree | 237b4e3967e911de024c0c57e9712c61ecdc0557 /lisp/comint.el | |
parent | 5d831bedd4fc74c395c96843fc0477eaf1cb307d (diff) | |
download | emacs-ca6007227294a1bea08d861f6d46a22e4993a0f2.tar.gz |
(comint-dynamic-complete-as-filename): Save end of match before calling other
functions. Handle non-match too.
Diffstat (limited to 'lisp/comint.el')
-rw-r--r-- | lisp/comint.el | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lisp/comint.el b/lisp/comint.el index 8be11e72219..7e57e88579b 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -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." (comint-dynamic-list-filename-completions)) (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)) |