From a126c06b0a5d585e7d7dd6d952b3f99447d15fc2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Mon, 16 Aug 2021 23:15:12 +0100 Subject: [PATCH] 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 --- etc/NEWS | 15 ++++++++------- lisp/icomplete.el | 15 ++++++++++++++- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 3ccef6683a5..aaff30bfa92 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -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. diff --git a/lisp/icomplete.el b/lisp/icomplete.el index cd1979d04ad..e06b33e43bb 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -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))) -- 2.39.2