summaryrefslogtreecommitdiff
path: root/lisp/simple.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-06-22 04:50:32 +0000
committerRichard M. Stallman <rms@gnu.org>1996-06-22 04:50:32 +0000
commit4a6f186932f2eedfd302528bad63fd14655828fa (patch)
treed394c84f791c473c423ab82e8e401eaa977c8deb /lisp/simple.el
parent45321cd038e714941189c8a2f193ed52e4b4eb54 (diff)
downloademacs-4a6f186932f2eedfd302528bad63fd14655828fa.tar.gz
(choose-completion-string): Don't exit the minibuffer
when a directory name is chosen.
Diffstat (limited to 'lisp/simple.el')
-rw-r--r--lisp/simple.el10
1 files changed, 9 insertions, 1 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 11dd51da17d..aba6583b34f 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2930,6 +2930,9 @@ With prefix argument N, move N items (negative N means move backward)."
;; Switch to BUFFER and insert the completion choice CHOICE.
;; BASE-SIZE, if non-nil, says how many characters of BUFFER's text
;; to keep. If it is nil, use choose-completion-delete-max-match instead.
+
+;; If BUFFER is the minibuffer, exit the minibuffer
+;; unless it is reading a file name and CHOICE is a directory.
(defun choose-completion-string (choice &optional buffer base-size)
(let ((buffer (or buffer completion-reference-buffer)))
;; If BUFFER is a minibuffer, barf unless it's the currently
@@ -2953,7 +2956,12 @@ With prefix argument N, move N items (negative N means move backward)."
;; If completing for the minibuffer, exit it with this choice.
(and (equal buffer (window-buffer (minibuffer-window)))
minibuffer-completion-table
- (exit-minibuffer)))))
+ ;; If this is reading a file name, and the file name chosen
+ ;; is a directory, don't exit the minibuffer.
+ (if (and (eq minibuffer-completion-table 'read-file-name-internal)
+ (file-directory-p (buffer-string)))
+ (select-window (active-minibuffer-window))
+ (exit-minibuffer))))))
(defun completion-list-mode ()
"Major mode for buffers showing lists of possible completions.