Function: completion--insert-vertical
completion--insert-vertical is a byte-compiled function defined in
minibuffer.el.gz.
Signature
(completion--insert-vertical STRINGS GROUP-FUN LENGTH WWIDTH COLWIDTH COLUMNS)
Source Code
;; Defined in /usr/src/emacs/lisp/minibuffer.el.gz
(defun completion--insert-vertical (strings group-fun
_length _wwidth
colwidth columns)
(while strings
(let ((group nil)
(column 0)
(row 0)
(rows)
(last-string nil))
(if group-fun
(let* ((str (car strings))
(title (funcall group-fun (if (consp str) (car str) str) nil)))
(while (and strings
(equal title (funcall group-fun
(if (consp (car strings))
(car (car strings))
(car strings))
nil)))
(push (car strings) group)
(pop strings))
(setq group (nreverse group)))
(setq group strings
strings nil))
(setq rows (/ (length group) columns))
(when group-fun
(let* ((str (car group))
(title (funcall group-fun (if (consp str) (car str) str) nil)))
(when title
(goto-char (point-max))
(insert (format completions-group-format title) "\n"))))
(dolist (str group)
(unless (equal last-string str) ; Remove (consecutive) duplicates.
(setq last-string str)
(when (> row rows)
(forward-line (- -1 rows))
(setq row 0 column (+ column colwidth)))
(when (> column 0)
(end-of-line)
(while (> (current-column) column)
(if (eobp)
(insert "\n")
(forward-line 1)
(end-of-line)))
(insert " \t")
(set-text-properties (1- (point)) (point)
`(display (space :align-to ,column))))
(completion--insert str group-fun)
(if (> column 0)
(forward-line)
(insert "\n"))
(setq row (1+ row)))))))