This is more of an enhancement suggestion than a bug report. If you are entering Lisp code for evaluation (e.g. `M-:'), then you don't want to exit the minibuffer when you complete a Lisp symbol. For example, you have "(sear" when you use `lisp-complete-symbol' to pick `search-forward'; you want the minibuffer to have "(search-forward" and let you continue to type code. For this reason, I modified choose-completion-string to recognize this. Below is my version from Emacs 20, but I think the code is about the same for Emacs 21 (the "problem" is still there, in any case). My code uses variable command-calling-for-completion from library `elect-mbuf.el', but the test could be done differently. That variable just holds the last command that caused display of the list of possible completions. ;; REPLACES ORIGINAL in `simple.el': ;; Don't exit minibuffer if this is just a `lisp-complete-symbol' completion. (defun choose-completion-string (choice &optional buffer base-size) "Switch to BUFFER and insert the completion choice CHOICE. BASE-SIZE, if non-nil, says how many chars of BUFFER's text to keep. If it is nil, use `choose-completion-delete-max-match' instead. If BUFFER is the minibuffer, then exit the minibuffer, unless: - it is reading a file name and CHOICE is a directory, *or* - `completion-no-auto-exit' is non-nil, *or* - this is just a `lisp-complete-symbol' completion." (let ((buffer (or buffer completion-reference-buffer))) ; In `simple.el'. ;; If BUFFER is a minibuffer, barf unless it's currently active. (when (and (string-match "\\` \\*Minibuf-[0-9]+\\*\\'" (buffer-name buffer)) (or (not (active-minibuffer-window)) (not (equal buffer (window-buffer (active-minibuffer-window)))))) (error "Minibuffer is not active for completion.")) ;; Insert the completion into the buffer where completion was requested. (set-buffer buffer) (if base-size (delete-region (+ base-size (point-min)) (point)) (choose-completion-delete-max-match choice)) (insert choice) (remove-text-properties (- (point) (length choice)) (point) '(mouse-face nil)) ;; Update point in the window that BUFFER is showing in. (let ((window (get-buffer-window buffer t))) (set-window-point window (point))) ;; If completing for the minibuffer, exit it with this choice, ;; unless this was a `lisp-complete-symbol' completion. (and (not completion-no-auto-exit) (equal buffer (window-buffer (minibuffer-window))) minibuffer-completion-table (not (and (boundp 'command-calling-for-completion) ; Defined in `elect-mbuf.el'. (eq 'lisp-complete-symbol command-calling-for-completion))) ;; 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)))))