Commit 5761e900 authored by Gregory Heytings's avatar Gregory Heytings Committed by João Távora
Browse files

Add new icomplete-vertical-mode

Co-authored-by: default avatarJoão Távora <>

* lisp/icomplete.el (icomplete-completions): Consider icomplete-vertical-mode.
(icomplete-vertical-mode-minibuffer-map): New map.
(icomplete--vertical-minibuffer-setup): New helper.
(icomplete-vertical-mode): New minor mode.

* doc/emacs/buffers.texi (Icomplete): Mention icomplete-vertical-mode.

* etc/NEWS: Mention icomplete-vertical-mode
parent ffd12743
Pipeline #10245 failed with stages
in 152 minutes and 17 seconds
......@@ -765,6 +765,15 @@ your initialization file (@pxref{Init File}):
the variable @code{fido-mode} to @code{t} (@pxref{Easy
@findex icomplete-vertical-mode
@cindex Icomplete vertical mode
Icomplete mode and Fido mode display the possible completions on the
same line as the prompt by default. To display the completion candidates
vertically under the prompt, type @kbd{M-x icomplete-vertical-mode}, or
customize the variable @code{icomplete-vertical-mode} to @code{t}
(@pxref{Easy Customization}).
@node Buffer Menus
@subsection Customizing Buffer Menus
......@@ -494,6 +494,13 @@ documented.
SMIE is now always enabled and 'ruby-use-smie' only controls whether
indentation is done using SMIE or with the old ad-hoc code.
** Icomplete
*** New minor mode Icomplete-Vertical mode.
This mode is intended to be used with Icomplete or Fido, to display the
list of completions candidates vertically instead of horizontally.
** Specific warnings can now be disabled from the warning buffer.
When a warning is displayed to the user, the resulting buffer now has
......@@ -562,6 +562,37 @@ Usually run by inclusion in `minibuffer-setup-hook'."
(completion--cache-all-sorted-completions beg end (cons comp all))))
finally return all)))
(defvar icomplete-vertical-mode-minibuffer-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "C-n") 'icomplete-forward-completions)
(define-key map (kbd "C-p") 'icomplete-backward-completions)
"Keymap used by `icomplete-vertical-mode' in the minibuffer.")
(defun icomplete--vertical-minibuffer-setup ()
"Setup the minibuffer for vertical display of completion candidates."
(use-local-map (make-composed-keymap icomplete-vertical-mode-minibuffer-map
(setq-local icomplete-separator "\n"
icomplete-hide-common-prefix nil
;; Ask `icomplete-completions' to return enough completions candidates.
icomplete-prospects-height 25
redisplay-adhoc-scroll-in-resize-mini-windows nil))
(define-minor-mode icomplete-vertical-mode
"Toggle vertical candidate display in `icomplete-mode' or `fido-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'."
:global t
(remove-hook 'icomplete-minibuffer-setup-hook
(when icomplete-vertical-mode
(add-hook 'icomplete-minibuffer-setup-hook
......@@ -784,10 +815,13 @@ matches exist."
(if last (setcdr last base-size))
(if prospects
(concat determ
(mapconcat 'identity prospects icomplete-separator)
(and limit (concat icomplete-separator ellipsis))
(if icomplete-vertical-mode " \n" "{")
(mapconcat 'identity prospects (if icomplete-vertical-mode
(unless icomplete-vertical-mode
(concat (and limit (concat icomplete-separator ellipsis))
(concat determ " [Matched]"))))))
;;; Iswitchb compatibility
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment