diff options
Diffstat (limited to 'lisp/comint.el')
| -rw-r--r-- | lisp/comint.el | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/lisp/comint.el b/lisp/comint.el index 8608c0d31e9..e4bc530f361 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -3134,19 +3134,20 @@ in the same way as TABLE completes strings of the form (concat S2 S)." #'comint--table-subvert #'completion-file-name-table (cdr prefixes) (car prefixes))))) - (list - filename-beg filename-end - (lambda (string pred action) - (let ((completion-ignore-case read-file-name-completion-ignore-case) - (completion-ignored-extensions comint-completion-fignore)) - (if (zerop (length filesuffix)) - (complete-with-action action table string pred) - ;; Add a space at the end of completion. Use a terminator-regexp - ;; that never matches since the terminator cannot appear - ;; within the completion field anyway. - (completion-table-with-terminator - (cons filesuffix "\\`a\\`") - table string pred action))))))) + (nconc + (list + filename-beg filename-end + (lambda (string pred action) + (let ((completion-ignore-case read-file-name-completion-ignore-case) + (completion-ignored-extensions comint-completion-fignore)) + (complete-with-action action table string pred)))) + (unless (zerop (length filesuffix)) + (list :exit-function + (lambda (_s finished) + (when (memq finished '(sole finished)) + (if (looking-at (regexp-quote filesuffix)) + (goto-char (match-end 0)) + (insert filesuffix))))))))) (defun comint-dynamic-complete-as-filename () "Dynamically complete at point as a filename. |
