aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/comint.el
diff options
context:
space:
mode:
authorRoland McGrath <[email protected]>1993-08-02 23:33:41 +0000
committerRoland McGrath <[email protected]>1993-08-02 23:33:41 +0000
commit314ed6a5aa357c4b55f3a897def29869a02dd752 (patch)
treee2c2c814f1524692b22f7735054ec484011b58c3 /lisp/comint.el
parentd49458c44a37319aec259e3f5197e006bf613610 (diff)
(comint-dynamic-complete): If called interactively twice in a row, give the
completion list.
Diffstat (limited to 'lisp/comint.el')
-rw-r--r--lisp/comint.el44
1 files changed, 24 insertions, 20 deletions
diff --git a/lisp/comint.el b/lisp/comint.el
index cfa8f61db8..fa71e58290 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -1181,26 +1181,30 @@ This function is similar to `comint-replace-by-expanded-filename', except
that it won't change parts of the filename already entered in the buffer;
it just adds completion characters to the end of the filename."
(interactive)
- (let* ((pathname (comint-match-partial-pathname))
- (pathdir (file-name-directory pathname))
- (pathnondir (file-name-nondirectory pathname))
- (completion (file-name-completion
- pathnondir
- ;; It is important to expand PATHDIR because
- ;; default-directory might be a handled name, and the
- ;; unexpanded PATHDIR won't necessarily match the
- ;; handler regexp.
- (if pathdir
- (expand-file-name pathdir)
- default-directory))))
- (cond ((null completion)
- (message "No completions of %s" pathname)
- (ding))
- ((eql completion t)
- (message "Sole completion"))
- (t ; this means a string was returned.
- (goto-char (match-end 0))
- (insert (substring completion (length pathnondir)))))))
+ (if (and (interactive-p)
+ (eq last-command this-command))
+ ;; If you hit TAB twice in a row, you get a completion list.
+ (comint-dynamic-list-completions)
+ (let* ((pathname (comint-match-partial-pathname))
+ (pathdir (file-name-directory pathname))
+ (pathnondir (file-name-nondirectory pathname))
+ (completion (file-name-completion
+ pathnondir
+ ;; It is important to expand PATHDIR because
+ ;; default-directory might be a handled name, and the
+ ;; unexpanded PATHDIR won't necessarily match the
+ ;; handler regexp.
+ (if pathdir
+ (expand-file-name pathdir)
+ default-directory))))
+ (cond ((null completion)
+ (message "No completions of %s" pathname)
+ (ding))
+ ((eql completion t)
+ (message "Sole completion"))
+ (t ; this means a string was returned.
+ (goto-char (match-end 0))
+ (insert (substring completion (length pathnondir))))))))
(defun comint-dynamic-list-completions ()
"List in help buffer all possible completions of the filename at point."