Mercurial > emacs
changeset 6797:42c6431d1e00
(comint-dynamic-complete-as-filename): Save end of match before calling other
functions. Handle non-match too.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Mon, 11 Apr 1994 20:30:44 +0000 |
parents | c451a18c1945 |
children | 2594f541e694 |
files | lisp/comint.el |
diffstat | 1 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/comint.el Mon Apr 11 20:09:44 1994 +0000 +++ b/lisp/comint.el Mon Apr 11 20:30:44 1994 +0000 @@ -1836,11 +1836,14 @@ (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 @@ (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))