help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Dismissing a completion buffer?


From: Drew Adams
Subject: RE: Dismissing a completion buffer?
Date: Tue, 13 Jan 2009 12:28:32 -0800

> > > When a completion buffer pops up, e.g. M-x o, enter something, hit
> > > tab... how do I dismiss that buffer?  Ctrl-g (cancel) 
> > > seems to have no effect; Ctrl-x k doesn't do the right thing; and
> > > hitting Esc doesn't have the desired effect.
>
> > In vanilla Emacs, `C-g' does nothing to remove this frame, 
> > as you say. Icicles does not have this problem:
> > http://www.emacswiki.org/cgi-bin/wiki/Icicles
> 
> (I'm fairly new to Emacs and still hazy on the interaction between
> pieces and parts...)
> 
> The completion buffer I'm concerned about is created while using SLIME
> to edit Lisp code / interact with a Lisp REPL.

I don't use SLIME, so I can't speak directly to that.

> Is my understanding correct that Icicles works with any completion
> buffer? (My assumption here is that buffers named "*Completions*"
> are some specific Emacs "thing" that code can interact with, which
> obviously may be incorrect...)

Icicles always uses buffer *Completions* for its completion. Any Emacs-Lisp code
that calls `completing-read' or `read-file-name' will, in Icicle mode,
automatically take advantage of Icicles completion enhancements.

In addition, some other existing Emacs-Lisp code can also take advantage of
Icicles - for example, Emacs-Lisp symbol completion, dabbrev completion, BBDB
completion, ESS completion, GUD completion, IELM completion, and shell-mode
completion generally:
http://www.emacswiki.org/emacs/Icicles_-_Completion_in_Other_Buffers

Yes, it is possible for some Emacs-Lisp code to display completions in a buffer
other than *Completions*. If it uses function `display-completion-list', then it
can provide any name it wants for the completion-candidates buffer.

Even if some Emacs-Lisp code does use the name "*Completions*" when it calls
`display-completion-list', if it does not also use the minibuffer for completion
(e.g. by calling `completing-read') then Icicles will not kick in - except for a
certain number of special cases (see above for examples) where Icicle mode
enhances the vanilla non-minibuffer completion.

For your specific question regarding SLIME mode completion, I don't know whether
it uses the minibuffer for completion. If it does not, then Icicles completion
will not automatically kick in - there is currently no SLIME mode-specific
enhancement by Icicles. (It could no doubt be added, just as it was added for
the kinds of non-minibuffer completion mentioned above.)

It's easy to download Icicles and try it, to see if it helps with SLIME-mode
completion:
http://www.emacswiki.org/emacs/Icicles_-_Libraries

If it does not, then let me know the specifics off-list, and I'll look into the
possibility of adding some SLIME-mode support.

Or you could add that support yourself, using this as a guideline:
http://www.emacswiki.org/emacs/Icicles_-_Defining_Completion_for_Comint_Modes
That is, if SLIME uses Comint mode ("a general-purpose mode for
communicating with interactive subprocesses" - Emacs manual), then adding
support for it is pretty simple.

If SLIME does not derive from Comint mode, but SLIME completion is similar to,
say, Emacs-Lisp symbol completion, then you can use
`icicle-lisp-complete-symbol' as a guideline. It is a simple enhancement to the
vanilla `lisp-complete-symbol': it just uses minibuffer completion whenever
there are multiple completion candidates.

In short, whenever the minibuffer is used for completion, Icicles kicks in. If
you have a function that completes buffer text without using the minibuffer,
then you can change it to call `completing-read' whenever there are multiple
completions. In that way, it will use the minibuffer for such a choice, and
Icicles will kick in.

HTH.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]