unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: "Florian v. Savigny" <florian@fsavigny.de>, help-gnu-emacs@gnu.org
Subject: RE: Any way to trick completion--insert-strings into using only	one column??
Date: Sun, 3 Jan 2016 07:46:58 -0800 (PST)	[thread overview]
Message-ID: <c57a76ea-44c6-4164-8154-b0ae9c1e5ca5@default> (raw)
In-Reply-To: <<87twmu90qc.fsf@bertrandrussell.Speedport_W_723V_1_39_000>>

> 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
> like.)

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'.]

FWIW -

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
`icicle-candidate-width-factor' and
`icicle-inter-candidate-min-spaces.

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.

More info:
http://www.emacswiki.org/emacs/Icicles_-_Completions_Display#ChangeCompletionsSpacingOnTheFly

Screenshots, showing some of the *Completions* display
possibilities (scroll down for more):
http://www.emacswiki.org/emacs/Icicles_-_Screenshots#AproposCompletion



       reply	other threads:[~2016-01-03 15:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <<87twmu90qc.fsf@bertrandrussell.Speedport_W_723V_1_39_000>
2016-01-03 15:46 ` Drew Adams [this message]
2016-01-03 14:49 Any way to trick completion--insert-strings into using only one column?? Florian v. Savigny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c57a76ea-44c6-4164-8154-b0ae9c1e5ca5@default \
    --to=drew.adams@oracle.com \
    --cc=florian@fsavigny.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).