diff options
| author | Chong Yidong | 2008-08-26 23:49:01 +0000 |
|---|---|---|
| committer | Chong Yidong | 2008-08-26 23:49:01 +0000 |
| commit | 4ecc814eaf3175c163e5d4769e52b6375bff14da (patch) | |
| tree | 7f6af1b6d1f78d16676ae3b27062170773f81f24 | |
| parent | a7dadf13ed82f9e3e93a5e3cdbb6bc1eafc673f0 (diff) | |
| download | emacs-4ecc814eaf3175c163e5d4769e52b6375bff14da.tar.gz emacs-4ecc814eaf3175c163e5d4769e52b6375bff14da.zip | |
(comint-dynamic-complete-as-filename): If case is ignored while
matching, replace the entire filename with completion.
| -rw-r--r-- | lisp/comint.el | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lisp/comint.el b/lisp/comint.el index 00528f38ab0..b8e73cb6b78 100644 --- a/lisp/comint.el +++ b/lisp/comint.el | |||
| @@ -2821,7 +2821,10 @@ See `comint-dynamic-complete-filename'. Returns t if successful." | |||
| 2821 | " ") | 2821 | " ") |
| 2822 | (t | 2822 | (t |
| 2823 | (cdr comint-completion-addsuffix)))) | 2823 | (cdr comint-completion-addsuffix)))) |
| 2824 | (filename (or (comint-match-partial-filename) "")) | 2824 | (filename (comint-match-partial-filename)) |
| 2825 | (filename-beg (if filename (match-beginning 0))) | ||
| 2826 | (filename-end (if filename (match-end 0))) | ||
| 2827 | (filename (or filename "")) | ||
| 2825 | (filedir (file-name-directory filename)) | 2828 | (filedir (file-name-directory filename)) |
| 2826 | (filenondir (file-name-nondirectory filename)) | 2829 | (filenondir (file-name-nondirectory filename)) |
| 2827 | (directory (if filedir (comint-directory filedir) default-directory)) | 2830 | (directory (if filedir (comint-directory filedir) default-directory)) |
| @@ -2839,9 +2842,19 @@ See `comint-dynamic-complete-filename'. Returns t if successful." | |||
| 2839 | (comint-dynamic-list-filename-completions)) | 2842 | (comint-dynamic-list-filename-completions)) |
| 2840 | (t ; Completion string returned. | 2843 | (t ; Completion string returned. |
| 2841 | (let ((file (concat (file-name-as-directory directory) completion))) | 2844 | (let ((file (concat (file-name-as-directory directory) completion))) |
| 2845 | (if (or (null read-file-name-completion-ignore-case) | ||
| 2846 | (null filename-beg) | ||
| 2847 | (null filename-end)) | ||
| 2848 | (insert (comint-quote-filename | ||
| 2849 | (substring (directory-file-name completion) | ||
| 2850 | (length filenondir))))) | ||
| 2851 | ;; If read-file-name-completion-ignore-case is non-nil, | ||
| 2852 | ;; the completion string may have a different case than | ||
| 2853 | ;; what's in the prompt. | ||
| 2854 | (delete-region filename-beg filename-end) | ||
| 2855 | (if filedir (insert filedir)) | ||
| 2842 | (insert (comint-quote-filename | 2856 | (insert (comint-quote-filename |
| 2843 | (substring (directory-file-name completion) | 2857 | (directory-file-name completion))) |
| 2844 | (length filenondir)))) | ||
| 2845 | (cond ((symbolp (file-name-completion completion directory)) | 2858 | (cond ((symbolp (file-name-completion completion directory)) |
| 2846 | ;; We inserted a unique completion. | 2859 | ;; We inserted a unique completion. |
| 2847 | (insert (if (file-directory-p file) dirsuffix filesuffix)) | 2860 | (insert (if (file-directory-p file) dirsuffix filesuffix)) |