[Top][All Lists]

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

Re: feature/icomplete-vertical

From: Ergus
Subject: Re: feature/icomplete-vertical
Date: Sun, 20 Sep 2020 15:04:35 +0200

Hi Joao:

The problem was that I was trying to avoid calling enlarge-window from
icomplete and rely on the internal resize mechanism (maybe that was the
main error) to avoid calculating the height in general. And of course
the prompt issue that came out when using different fonts as a
surprise. I tried to solve that without the enlarge to respect also the
resize-mini-windows either when t or grow-only.

Initially I separated icomplete--prospects only, but then all the height
calculation complexity came and that's why I ended with the complex
approach. I didn't know that the prompt issue disappeared with

(setq resize-mini-windows nil)

What I wonder about this is the potential conflicts when another package
or function relies on resize-mini-windows. And that the ... is not shown
to indicate that there are more candidates.

OTOH: My main goal (more than the vertical) was to implement a sort of
zsh like completion. (similar to what I did for *Completions* buffer) so
at least I will request to avoid using only and advise.

On Sun, Sep 20, 2020 at 11:55:52AM +0100, Jo�o T�vora wrote:
I'm late to the party here, but I'd just like to add that
Gregory's solution based on advice can easily be be integrated into
icomplete-mode directly.  I do like that it's such a simple solution,
doesn't include new defcustoms, modes and such.  I didn't have
a in-depth look, but it looks like your solution Ergus, is quite a bit
more complex.  Why?  What extras does it bring to the table?
And are we sure we need those extras in the first version of this?

Or am I missing something and is Gregory's solution fundamentally

My 2c,

On Sat, Sep 12, 2020 at 2:33 PM Ergus <spacibba@aol.com> wrote:

On Sat, Sep 12, 2020 at 01:10:57PM +0000, Gregory Heytings wrote:
>>>If there was a built-in vertical mode it would be better / more
>>Could you try the branch feature/icomplete-vertical? I need some
>>testers before adding it to master.
>Alas no, I have been using the following to have icomplete-vertical
>for quite some time, it works perfectly well, so I don't see why a
>more complex implementation would be necessary.
>(setq icomplete-prospects-height 6)
>(setq icomplete-separator "\n")
>(defun icomplete-vertical-minibuffer-setup ()
>  (setq truncate-lines t)
>  (setq-local completion-ignore-case t)
>  (setq-local read-file-name-completion-ignore-case t)
>  (setq-local read-buffer-completion-ignore-case t)
>  (setq icomplete-hide-common-prefix nil))
>(add-hook 'icomplete-minibuffer-setup-hook
>(defun icomplete-vertical-reformat-completions (completions)
>  (save-match-data
>    (let ((cnp (substring-no-properties completions)))
>      (if (string-match "^\\((.*)\\|\\[.+\\]\\)?{\\(\\(?:.\\|\n\\)+\\)}"
>          (format "%s \n%s"
>                  (or (match-string 1 cnp) "")
>                  (replace-regexp-in-string "^" (make-string
(current-column) ? ) (match-string 2 cnp)))
>        cnp))))
>(defun icomplete-vertical-adjust-minibuffer-height (completions)
>  (let* ((comp (icomplete-vertical-reformat-completions completions))
>         (complen (length (split-string comp "\n"))))
>    (if (> complen 1) (enlarge-window (- icomplete-prospects-height (1-
>    comp))
>(advice-add 'icomplete-completions :filter-return

1) Internal functionalities try not to use advises.
2) The branch is not actually more complex, it just generates the
formatted vertical output form the beginning.
3) It does more or less the same you are doing but with a simpler

(icomplete-mode t)
(icomplete-format 'vertical)

4) We add arrow bindings to move
5) Add completion matching faces is also coming.

Jo�o T�vora

reply via email to

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