From: Richard M. Stallman Date: Fri, 31 Dec 1999 04:02:38 +0000 (+0000) Subject: (choose-completion-string): In minibuffer, X-Git-Tag: emacs-pretest-21.0.90~5585 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f436a90ae2a6ab5abb932cc9adde1ef98166a199;p=emacs.git (choose-completion-string): In minibuffer, do not delete the prompt string. --- diff --git a/lisp/simple.el b/lisp/simple.el index 84d7e6e4afa..ec8b0f73097 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3820,10 +3820,11 @@ With prefix argument N, move N items (negative N means move backward)." ;; 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 @@ With prefix argument N, move N items (negative N means move backward)." ;; 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)