diff options
| author | Karl Heuer | 1994-04-11 20:30:44 +0000 |
|---|---|---|
| committer | Karl Heuer | 1994-04-11 20:30:44 +0000 |
| commit | ca6007227294a1bea08d861f6d46a22e4993a0f2 (patch) | |
| tree | 237b4e3967e911de024c0c57e9712c61ecdc0557 | |
| parent | 5d831bedd4fc74c395c96843fc0477eaf1cb307d (diff) | |
| download | emacs-ca6007227294a1bea08d861f6d46a22e4993a0f2.tar.gz emacs-ca6007227294a1bea08d861f6d46a22e4993a0f2.zip | |
(comint-dynamic-complete-as-filename): Save end of match before calling other
functions. Handle non-match too.
| -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." | |||
| 1836 | (let* ((completion-ignore-case nil) | 1836 | (let* ((completion-ignore-case nil) |
| 1837 | (completion-ignored-extensions comint-completion-fignore) | 1837 | (completion-ignored-extensions comint-completion-fignore) |
| 1838 | (success t) | 1838 | (success t) |
| 1839 | (filename (or (comint-match-partial-filename) "")) | 1839 | (filename (comint-match-partial-filename)) |
| 1840 | (pathdir (file-name-directory filename)) | 1840 | endpos pathdir pathnondir directory completion) |
| 1841 | (pathnondir (file-name-nondirectory filename)) | 1841 | (setq endpos (if filename (match-end 0) (point))) |
| 1842 | (directory (if pathdir (comint-directory pathdir) default-directory)) | 1842 | (or filename (setq filename "")) |
| 1843 | (completion (file-name-completion pathnondir directory))) | 1843 | (setq pathdir (file-name-directory filename) |
| 1844 | pathnondir (file-name-nondirectory filename) | ||
| 1845 | directory (if pathdir (comint-directory pathdir) default-directory) | ||
| 1846 | completion (file-name-completion pathnondir directory)) | ||
| 1844 | (cond ((null completion) | 1847 | (cond ((null completion) |
| 1845 | (message "No completions of %s" filename) | 1848 | (message "No completions of %s" filename) |
| 1846 | (setq success nil)) | 1849 | (setq success nil)) |
| @@ -1851,7 +1854,7 @@ See `comint-dynamic-complete-filename'. Returns t if successful." | |||
| 1851 | (comint-dynamic-list-filename-completions)) | 1854 | (comint-dynamic-list-filename-completions)) |
| 1852 | (t ; Completion string returned. | 1855 | (t ; Completion string returned. |
| 1853 | (let ((file (concat (file-name-as-directory directory) completion))) | 1856 | (let ((file (concat (file-name-as-directory directory) completion))) |
| 1854 | (goto-char (match-end 0)) | 1857 | (goto-char endpos) |
| 1855 | (insert (substring (directory-file-name completion) | 1858 | (insert (substring (directory-file-name completion) |
| 1856 | (length pathnondir))) | 1859 | (length pathnondir))) |
| 1857 | (cond ((symbolp (file-name-completion completion directory)) | 1860 | (cond ((symbolp (file-name-completion completion directory)) |