# HG changeset patch # User Chong Yidong # Date 1219856674 0 # Node ID 870ef2dba09071c7f31b147b90b10ec65e39354d # Parent 3971edd65203af9acf3cb48abd9e925e9d1b7f1c (comint-dynamic-complete-as-filename): Generalize last change to allow quoting of characters before point. diff -r 3971edd65203 -r 870ef2dba090 lisp/comint.el --- a/lisp/comint.el Wed Aug 27 17:04:23 2008 +0000 +++ b/lisp/comint.el Wed Aug 27 17:04:34 2008 +0000 @@ -2822,8 +2822,8 @@ (t (cdr comint-completion-addsuffix)))) (filename (comint-match-partial-filename)) - (filename-beg (if filename (match-beginning 0))) - (filename-end (if filename (match-end 0))) + (filename-beg (if filename (match-beginning 0) (point))) + (filename-end (if filename (match-end 0) (point))) (filename (or filename "")) (filedir (file-name-directory filename)) (filenondir (file-name-nondirectory filename)) @@ -2842,19 +2842,12 @@ (comint-dynamic-list-filename-completions)) (t ; Completion string returned. (let ((file (concat (file-name-as-directory directory) completion))) - (if (or (null read-file-name-completion-ignore-case) - (null filename-beg) - (null filename-end)) - (insert (comint-quote-filename - (substring (directory-file-name completion) - (length filenondir))))) - ;; If read-file-name-completion-ignore-case is non-nil, - ;; the completion string may have a different case than - ;; what's in the prompt. + ;; Insert completion. Note that the completion string + ;; may have a different case than what's in the prompt, + ;; if read-file-name-completion-ignore-case is non-nil, (delete-region filename-beg filename-end) (if filedir (insert filedir)) - (insert (comint-quote-filename - (directory-file-name completion))) + (insert (comint-quote-filename (directory-file-name completion))) (cond ((symbolp (file-name-completion completion directory)) ;; We inserted a unique completion. (insert (if (file-directory-p file) dirsuffix filesuffix))