3

Is there a simple way to make it so that the *Completions* buffer that pops up when, say, tab completing on a find-file doesn't create a new buffer but shows the possible completions in the minibuffer? I've spent quite a bit of time trying to figure out how to do this, but am finding it a lot harder than I expected.

7
  • Depending upon how many completions exist, this idea would substantially increase the size of the minibuffer window, so additional planning might be needed before changing the default behavior. You may be interested in trying out ido that creates the possibility for both -- i.e., see completions in the minibuffer using ido (a rotating single line of possibilities to scroll through, that narrows options as a user types), and the tab key pops upen the *Completions* buffer if so desired. Commented Nov 19, 2017 at 0:10
  • What you describe is essentially what icomplete-mode and ido-mode provide. Both come standard with Emacs. Commented Nov 19, 2017 at 2:05
  • Thanks for the suggestions. Unfortunately, these aren't what I was looking for. I was looking for the *Completions* buffer, as-is, to instead be a minibuffer, not a rotating single line or a modified version which icomplete-mode and ido-mode provide. Commented Nov 19, 2017 at 4:39
  • I went through a few of the functions in minibuffer.el and saw enough to make me believe that this probably cannot be answered within the scope of what generally fits into answers on this forum. It looks to me like this feature request would be a new library that is a modification of the aforementioned. That's not to say that it wouldn't be a nifty feature, it's just too time consuming and lengthy for someone to take the time to write-up unless its something they want to use themselves on a regular basis or they have lots of free time on their hands. It would exceed the character limit. Commented Nov 19, 2017 at 5:44
  • Ah, I see, that's unfortunate, I guessed it had been done before and I just wasn't searching for the right thing. I'm not sure what the best course of action is then...delete this question? Commented Nov 19, 2017 at 6:44

3 Answers 3

2

If ido doesn't do what you want, maybe also have a look at ivy. It will display completions in the minibuffer. By default, it will make the minibuffer 10 lines tall during completion, which is enough to see the most relevant completion candidates without taking over your frame too much. When this completion list is displayed, you can browse it with C-n and C-p (or up and down arrow keys) to highlight the completion candidate you want. As soon as you accept a completion, the minibuffer will shrink back to its normal size.

1

As mentioned by Drew, icomplete-mode would be the most obvious answer. From a subsequent comment you seem to say that it doesn't cut it, but it's not clear why.

In ido, you can set ido-decorations such that every candidate is listed on a separate line, and it shouldn't be too difficult to change icomplete-mode to do the same.

Would that satisfy your needs? It still would be pretty far from the functionality of *Completions*, since it still wouldn't let you click on a completion to choose one, not scroll the completions or search them with C-s, ...

Then again, what part of "in the minibuffer" matters to you? After all, in many cases the only difference is the presence of a modeline between the completions and the text you're typing.

0

In emacs 30, icomplete-vertical-mode provides something like that.

enter image description here

here's my configuration:

(use-package icomplete :demand t :custom ;; For info: C-h v completion-styles-alist (completion-styles '(flex partial-completion substring)) ;; flex initials basic (completion-category-overrides '((buffer (styles initials flex) (cycle . 10)) ;; C-h v completion-cycle-threshold (file (styles basic substring) (cycle . 10)) (symbol-help (styles basic shorthand substring)))) (read-file-name-completion-ignore-case t) (read-buffer-completion-ignore-case t) (completion-ignore-case t) (max-mini-window-height 0.2) (icomplete-prospects-height 15) (icomplete-show-matches-on-no-input t) :config (icomplete-mode) (icomplete-vertical-mode) :bind (:map icomplete-vertical-mode-minibuffer-map ;; icomplete-minibuffer-map <== for the non-vertical version ("TAB" . icomplete-force-complete) ("RET" . icomplete-force-complete-and-exit) ("C-c C-j" . exit-minibuffer) ;; exit without completion ("C-v" . icomplete-vertical-mode) ;; toggle ) ) 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.