[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
choose-completion-string should not exit minibuffer upon lisp-complete-s
choose-completion-string should not exit minibuffer upon lisp-complete-symbol
Tue, 21 Sep 2004 15:28:22 -0700
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
ORIGINAL in `simple.el':
;; Don't exit minibuffer if this is just a
(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'
If BUFFER is the minibuffer, then exit the minibuffer,
- it is reading a file name and CHOICE is a directory,
- `completion-no-auto-exit' is non-nil,
- this is just a `lisp-complete-symbol'
(let ((buffer (or buffer completion-reference-buffer))) ;
;; If BUFFER is a minibuffer, barf unless
it's currently active.
(when (and (string-match "\\`
(error "Minibuffer is not active for completion."))
Insert the completion into the buffer where completion was
base-size (point-min)) (point))
(remove-text-properties (- (point) (length
;; Update point in the window that
BUFFER is showing in.
(let ((window (get-buffer-window
;; If completing for the minibuffer, exit it
with this choice,
;; unless this was a
(equal buffer (window-buffer
(not (and (boundp 'command-calling-for-completion) ; Defined
;; If this is reading a file name, and the file name
;; is a directory,
don't exit the minibuffer.
(if (and (eq minibuffer-completion-table
- choose-completion-string should not exit minibuffer upon lisp-complete-symbol,
Drew Adams <=