[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Any way to trick completion--insert-strings into using only one colu
RE: Any way to trick completion--insert-strings into using only one column??
Sun, 3 Jan 2016 07:46:58 -0800 (PST)
> The above function seems hardcoded to display at least two columns. Of
> course, it so happens that I want it to display only one column in a
> specific circumstance (the help buffer appears in a side window and
> the completion strings are long, to be precise).
> I have looked for ways of making the function believe it should only
> display one column by re-defining some variable around it locally, but
> this does not seem to be possible; it seems to display two columns
> even if the completion strings are 1000 characters long.
> Am I missing something here, or is the only way to get this behaviour
> to redefine the function? (This could be done in quite a handy way,
> e.g. the function could consider the width of the help window and
> decide to show only as many columns as will show completely, or the
As you have probably seen by looking at the code of
`completion--insert-strings', it hard-codes a minimum of two
columns (unless there are less than 3 candidates). So I'm
afraid that your only option in this regard is to redefine it
(or advise it in such a way that you effectively redefine it).
[Consider filing an enhancement request to not hard-code such
behavior: `M-x report-emacs-bug'.]
If you use Icicles then what you are looking for is done
automatically. And you can also control the behavior,
by configuration or on the fly during completion.
When Icicle minor mode is enabled, the number of *Completions*
columns is adjusted to better fit the set of current candidates.
You can tweak this adjustment using options
You can choose anything from (a) closely packing the candidates,
to show more in the same window space, to (b) separating them
widely and aligning them rigorously.
If you also use library Do Re Mi then you can adjust these
options and the candidate display incrementally, on the fly,
using the arrow keys.
You can also just override automatic adjustment using option
`icicle-Completions-max-columns'. For example, binding or
setting it to 1 ensures that only one column is used.
Screenshots, showing some of the *Completions* display
possibilities (scroll down for more):