2

In Windows (the command prompt) when you hit TAB to complete a file name, you get a full file name, and can cycle through the completions by hitting TAB.

Is there any ready way to get emacs to do this, instead of (or additional to) displaying the completions for mouse choice in a buffer?

  • Have you looked at zlc? – PythonNut Oct 4 '15 at 3:19
  • Where are you looking to do this? In a shell inside emacs? In the find-file prompt? – zck Oct 4 '15 at 4:47
  • Yes in the find-file minibuffer – GreenAsJade Oct 4 '15 at 22:48
4

Not sure what you mean by a full file name. Do you mean that you want to see absolute file names as completion candidates, instead of relative names?

(Based on your use of the find-file tag, I'm assuming that you mean completion when using a file-finding command (e.g. C-x C-f), and not completion when in a shell buffer.)


  1. In vanilla Emacs, if you set option completion-cycle-threshold to t then repeating TAB cycles through the completion candidates (in a predefined order, and in one direction only).

  2. If you use Icicles, you can cycle among candidates in different sort orders and both directions. And if you like, you can complete against absolute file names ("full" names).

    This page provides more information about Icicles file-name completion.

Other completion packages also let you cycle among file names. No doubt someone else will post more information about those.

  • 1
    completion-cycle-threshold t was exactly what I was looking for, thanks! – GreenAsJade Oct 4 '15 at 10:20
  • ... but it doesn't work for me :(. It is "not documented as a variable", and appears to have no effect. GNU Emacs 23.2.1 Specifically, when I do C-x C-f TAB, I get a completion buffer and no completion in the mini-buffer. TAB causes the completion buffer to scroll. – GreenAsJade Oct 4 '15 at 22:53
  • @GreenAsJade: It was added to GNU Emacs in Emacs 24.1. Use Icicles. ;-) – Drew Oct 5 '15 at 5:15
  • Dang looks like I'm overdue updating my emacs on my windows VM! – GreenAsJade Oct 5 '15 at 9:35
  • Woo hoo emacs 24 works as advertised (of course). – GreenAsJade Oct 5 '15 at 9:56
0

hippie-expand facilitates completion commands using any arbitrary set of criteria:

(defalias 'my-complete-file-name
  (make-hippie-expand-function '(try-complete-file-name))
  "A variant of `hippie-expand' which completes only file names.")

(global-set-key (kbd "C-c f") 'my-complete-file-name)

As with hippie-expand in general, you just repeat the binding (or repeat it with C-x z z z... *) to cycle through all the possible completions.

(*) Although that's more awkward if you use this in the minibuffer on account of repeat echoing a message, so an easy-to-type binding may be preferable.

0

M-x ido-mode

https://www.youtube.com/watch?v=lsgPNVIMkIE

Not exactly the desired behaviour, but quite close.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.