Mercurial > emacs
comparison lisp/simple.el @ 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 | 8063bfbd8b08 |
children | e200e2db8e99 |
comparison
equal
deleted
inserted
replaced
27049:53146c13106f | 27050:5c0c5089979c |
---|---|
3818 | 3818 |
3819 ;; If BUFFER is the minibuffer, exit the minibuffer | 3819 ;; If BUFFER is the minibuffer, exit the minibuffer |
3820 ;; unless it is reading a file name and CHOICE is a directory, | 3820 ;; unless it is reading a file name and CHOICE is a directory, |
3821 ;; or completion-no-auto-exit is non-nil. | 3821 ;; or completion-no-auto-exit is non-nil. |
3822 (defun choose-completion-string (choice &optional buffer base-size) | 3822 (defun choose-completion-string (choice &optional buffer base-size) |
3823 (let ((buffer (or buffer completion-reference-buffer))) | 3823 (let ((buffer (or buffer completion-reference-buffer)) |
3824 (mini-p (string-match "\\` \\*Minibuf-[0-9]+\\*\\'" (buffer-name buffer)))) | |
3824 ;; If BUFFER is a minibuffer, barf unless it's the currently | 3825 ;; If BUFFER is a minibuffer, barf unless it's the currently |
3825 ;; active minibuffer. | 3826 ;; active minibuffer. |
3826 (if (and (string-match "\\` \\*Minibuf-[0-9]+\\*\\'" (buffer-name buffer)) | 3827 (if (and mini-p |
3827 (or (not (active-minibuffer-window)) | 3828 (or (not (active-minibuffer-window)) |
3828 (not (equal buffer | 3829 (not (equal buffer |
3829 (window-buffer (active-minibuffer-window)))))) | 3830 (window-buffer (active-minibuffer-window)))))) |
3830 (error "Minibuffer is not active for completion") | 3831 (error "Minibuffer is not active for completion") |
3831 ;; Insert the completion into the buffer where completion was requested. | 3832 ;; Insert the completion into the buffer where completion was requested. |
3832 (set-buffer buffer) | 3833 (set-buffer buffer) |
3833 (if base-size | 3834 (if base-size |
3834 (delete-region (+ base-size (point-min)) (point)) | 3835 (delete-region (+ base-size (if mini-p |
3836 (minibuffer-prompt-end) | |
3837 (point-min))) | |
3838 (point)) | |
3835 (choose-completion-delete-max-match choice)) | 3839 (choose-completion-delete-max-match choice)) |
3836 (insert choice) | 3840 (insert choice) |
3837 (remove-text-properties (- (point) (length choice)) (point) | 3841 (remove-text-properties (- (point) (length choice)) (point) |
3838 '(mouse-face nil)) | 3842 '(mouse-face nil)) |
3839 ;; Update point in the window that BUFFER is showing in. | 3843 ;; Update point in the window that BUFFER is showing in. |