changeset 27050:5c0c5089979c

(choose-completion-string): In minibuffer, do not delete the prompt string.
author Richard M. Stallman <rms@gnu.org>
date Fri, 31 Dec 1999 04:02:38 +0000
parents 53146c13106f
children 66940eaf5c5c
files lisp/simple.el
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Thu Dec 30 17:49:14 1999 +0000
+++ b/lisp/simple.el	Fri Dec 31 04:02:38 1999 +0000
@@ -3820,10 +3820,11 @@
 ;; unless it is reading a file name and CHOICE is a directory,
 ;; or completion-no-auto-exit is non-nil.
 (defun choose-completion-string (choice &optional buffer base-size)
-  (let ((buffer (or buffer completion-reference-buffer)))
+  (let ((buffer (or buffer completion-reference-buffer))
+	(mini-p (string-match "\\` \\*Minibuf-[0-9]+\\*\\'" (buffer-name buffer))))
     ;; If BUFFER is a minibuffer, barf unless it's the currently
     ;; active minibuffer.
-    (if (and (string-match "\\` \\*Minibuf-[0-9]+\\*\\'" (buffer-name buffer))
+    (if (and mini-p
 	     (or (not (active-minibuffer-window))
 		 (not (equal buffer
 			     (window-buffer (active-minibuffer-window))))))
@@ -3831,7 +3832,10 @@
       ;; Insert the completion into the buffer where completion was requested.
       (set-buffer buffer)
       (if base-size
-	  (delete-region (+ base-size (point-min)) (point))
+	  (delete-region (+ base-size (if mini-p
+					  (minibuffer-prompt-end)
+					(point-min)))
+			 (point))
 	(choose-completion-delete-max-match choice))
       (insert choice)
       (remove-text-properties (- (point) (length choice)) (point)