changeset 15484:e3f8bfd1bb1f

(choose-completion-string): Don't exit the minibuffer when a directory name is chosen.
author Richard M. Stallman <rms@gnu.org>
date Sat, 22 Jun 1996 04:50:32 +0000
parents fb582ab686db
children d3b17e7049bf
files lisp/simple.el
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Sat Jun 22 03:44:21 1996 +0000
+++ b/lisp/simple.el	Sat Jun 22 04:50:32 1996 +0000
@@ -2930,6 +2930,9 @@
 ;; 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 @@
       ;; 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.