emacs-devel
[Top][All Lists]
Advanced

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

Re: feature/icomplete-vertical


From: Ergus
Subject: Re: feature/icomplete-vertical
Date: Mon, 14 Sep 2020 09:08:20 +0200

On Mon, Sep 14, 2020 at 02:44:59PM +0800, jixiuf wrote:


2020年9月12日 下午9:33,Ergus <spacibba@aol.com> 写道:

On Sat, Sep 12, 2020 at 01:10:57PM +0000, Gregory Heytings wrote:


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)

1) Internal functionalities try not to use advises.
2) The branch is not actually more complex, it just generates the
formatted vertical output form the beginning.
3) It does more or less the same you are doing but with a simpler
config:

(icomplete-mode t)
(icomplete-format 'vertical)

4) We add arrow bindings to move
5) Add completion matching faces is also coming.


Some feedback about  branch : feature/icomplete-vertical

I tried this branch with config:

 (icomplete-mode 1)
 (setq icomplete-format 'vertical)



And found this bug still exists:

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=24293
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=39379

Some related links about how to work around this bug:

https://www.reddit.com/r/emacs/comments/fswt7c/using_icomplete_vertically/fm86m0q?utm_source=share&utm_medium=web2x&context=3
https://www.reddit.com/r/emacs/comments/fswt7c/using_icomplete_vertically/fm8z6h0?utm_source=share&utm_medium=web2x&context=3

Hope the problem of   disappearing prompt and entered text problem can be fixed 
in your branch.



Hi:

I can't reproduce https://debbugs.gnu.org/cgi/bugreport.cgi?bug=24293
with this config.

emacs -Q
(icomplete-mode 1)
(setq icomplete-format 'vertical)

The prompt is not disappearing for me. Is there some other
indication/config missing?


reply via email to

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