emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/icomplete-vertical


From: Gregory Heytings
Subject: feature/icomplete-vertical
Date: Sat, 12 Sep 2020 13:10:57 +0000
User-agent: Alpine 2.22 (NEB 394 2020-01-19)



If there was a built-in vertical mode it would be better / more intuitive.

Could you try the branch feature/icomplete-vertical? I need some testers before adding it to master.


Alas no, I have been using the following to have icomplete-vertical for quite some time, it works perfectly well, so I don't see why a more complex implementation would be necessary.

(setq icomplete-prospects-height 6)
(setq icomplete-separator "\n")
(defun icomplete-vertical-minibuffer-setup ()
  (setq truncate-lines t)
  (setq-local completion-ignore-case t)
  (setq-local read-file-name-completion-ignore-case t)
  (setq-local read-buffer-completion-ignore-case t)
  (setq icomplete-hide-common-prefix nil))
(add-hook 'icomplete-minibuffer-setup-hook 
#'icomplete-vertical-minibuffer-setup)
(defun icomplete-vertical-reformat-completions (completions)
  (save-match-data
    (let ((cnp (substring-no-properties completions)))
      (if (string-match "^\\((.*)\\|\\[.+\\]\\)?{\\(\\(?:.\\|\n\\)+\\)}" cnp)
          (format "%s \n%s"
                  (or (match-string 1 cnp) "")
                  (replace-regexp-in-string "^" (make-string (current-column) ? 
) (match-string 2 cnp)))
        cnp))))
(defun icomplete-vertical-adjust-minibuffer-height (completions)
  (let* ((comp (icomplete-vertical-reformat-completions completions))
         (complen (length (split-string comp "\n"))))
    (if (> complen 1) (enlarge-window (- icomplete-prospects-height (1- 
(window-height)))))
    comp))
(advice-add 'icomplete-completions :filter-return 
#'icomplete-vertical-adjust-minibuffer-height)



reply via email to

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