emacs-devel
[Top][All Lists]
Advanced

[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 16:49:03 +0200

On Sun, Sep 20, 2020 at 02:07:45PM +0000, Gregory Heytings wrote:

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.

resize-mini-windows is a user option, so resetting it globally is almost certainly a non-starter.


The three lines I sent:

(setq icomplete-separator "\n")
(setq icomplete-prospects-height 10)
(add-hook 'icomplete-minibuffer-setup-hook (function (lambda () (setq 
resize-mini-windows nil) (enlarge-window icomplete-prospects-height))))

had no other purpose except demonstrating that (setq resize-mini-windows nil) solves the problem of disappearing prompts. Of course I do not consider that these lines should be blindly used, in fact I wrote "It needs some tweaking, but it works." Indeed one should do something with user preferences, and use a setq-local. The point is that doing this is much simpler than trying to calculate the height of the completion candidate list, which amount (as Stefan wrote) to redoing what redisplay does.

Hi Gregory:

When the display engine have resize-mini-windows not nil it will try to
resize the windows after an action in minibuffer. This happens
automatically and setting it as local or so will still overwrite the
user choice.

What we need is to inhibit that behavior while icomplete is active We
could add a hook to minibuffer-exit-hook to reset resize-mini-windows to
it's original value (and remove itself)

Something like (untested)

(setq icomplete-separator "\n")
(setq icomplete-prospects-height 10)
(defvar icomplete-saved-resize-mini-windows nil)

(defun icomplete-minibuffer-exit-hook ()
    (setq resize-mini-windows icomplete-saved-resize-mini-windows)
    (remove-hook 'minibuffer-exit-hook #'icomplete-minibuffer-exit-hook))

(add-hook 'icomplete-minibuffer-setup-hook
          '(lambda ()
              (setq icomplete-saved-resize-mini-windows resize-mini-windows)
              (setq resize-mini-windows nil)
              (enlarge-window icomplete-prospects-height)
              (add-hook 'minibuffer-exit-hook #icomplete-minibuffer-exit-hook)))

Should probably work. (But this still looks like a workaround more than
a solution to me.)



reply via email to

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