How can I show all the improvements right after the reading is completed?

I am writing Emacs helper mode, and in it I use completing-readso that the user can select from a large set of search results. Each time they are different, so probably the user will not know what he wants without looking at the list. For this reason, I would like to show a temporary buffer with all the additions immediately, and not wait for the user to press Tab, but it is not obvious to me how to do this. Is there a way, and what is it?

+3
source share
3 answers

You can get this by using minibuffer-with-setup-hookand adding minibuffer-completeto the installation hook, for example:

(setq tmp '("cat" "dog" "fish"))

(minibuffer-with-setup-hook 'minibuffer-complete
  (completing-read (concat "Pick one (" 
                           (mapconcat 'identity (all-completions "" tmp) " ") 
                           "): ") 
                   tmp))
+6
source

. , -, , . , .

(setq tmp '("cat" "dog" "fish"))

(completing-read (concat "Pick one (" 
                         (mapconcat 'identity (all-completions "" tmp) " ") 
                         "): ") 
                 tmp)
0

Use Icicles and bind to the call : icicle-show-Completions-initially-flagcompleting-read

(let ((icicle-show-Completions-initially-flag  t))
  (completing-read ...))
0
source

Source: https://habr.com/ru/post/1788493/


All Articles