Make icomplete-vertical-mode take immediate effect (bug#49075)

* etc/NEWS: Mention change.

* lisp/icomplete.el (icomplete-vertical-mode):
(fido-vertical-mode): Tweak docstring.  Turn on
icomplete-mode. and fido-mdoe
This commit is contained in:
João Távora 2021-08-16 23:15:12 +01:00
parent ae751f2a09
commit a126c06b0a
2 changed files with 22 additions and 8 deletions

View file

@ -655,13 +655,14 @@ This allows controlling the current/total number of matches for the
prompt prefix.
+++
*** New minor mode 'icomplete-vertical-mode', alias 'fido-vertical-mode'.
This mode is intended to be used with Icomplete ('M-x icomplete-mode')
or Fido ('M-x fido-mode'), to display the list of completions
candidates vertically instead of horizontally. When used with
Icomplete, completions are rotated and selection kept at the top.
When used with Fido, completions scroll like a typical dropdown
widget.
*** New minor modes 'icomplete-vertical-mode' and 'fido-vertical-mode'
These modes are modify Icomplete ('M-x icomplete-mode') and Fido ('M-x
fido-mode'), to display completions candidates vertically instead of
horizontally. In Icomplete, completions are rotated and selection
kept at the top. In Fido, completions scroll like a typical dropdown
widget. Both these new minor modes will first turn on their
respective non-vertical counterparts first, if they are not on
already.
---
*** Default value of 'icomplete-compute-delay' has been changed to 0.15 s.

View file

@ -626,6 +626,8 @@ Usually run by inclusion in `minibuffer-setup-hook'."
(define-minor-mode icomplete-vertical-mode
"Toggle vertical candidate display in `icomplete-mode' or `fido-mode'.
If none of these modes are on, turn on `icomplete-mode'.
As many completion candidates as possible are displayed, depending on
the value of `max-mini-window-height', and the way the mini-window is
resized depends on `resize-mini-windows'."
@ -633,10 +635,21 @@ resized depends on `resize-mini-windows'."
(remove-hook 'icomplete-minibuffer-setup-hook
#'icomplete--vertical-minibuffer-setup)
(when icomplete-vertical-mode
(unless icomplete-mode
(icomplete-mode 1))
(add-hook 'icomplete-minibuffer-setup-hook
#'icomplete--vertical-minibuffer-setup)))
(defalias 'fido-vertical-mode 'icomplete-vertical-mode)
;;;###autoload
(define-minor-mode fido-vertical-mode
"Toggle vertical candidate display in `fido-mode'.
When turning on, if non-vertical `fido-mode' is off, turn it on.
If it's on, just add the vertical display."
:global t
(icomplete-vertical-mode -1)
(when fido-vertical-mode
(unless fido-mode (fido-mode 1))
(icomplete-vertical-mode 1)))