1

I'm trying to read a directory path using ido-read-directory-nameto prompt in the minibuffer. I have (ido-everywhere t)and (ido-enable-flex-matching t) enabled, and I'm running emacs 24.5.1.

I expect ido-read-directory-nameto behave like ido-read-file-name, by showing all possible flex matches in the minibuffer. I expect it to show me ONLY directory name matches (not file name matches), since I'm reading for directory names.

But instead of showing matches in the minibuffer, it shows only [.]after the current directory match, like so /usr/bin/[.], which is not what I want.

If I hit TAB once, potential directory matches are displayed in a regular emacs buffer (named "Ido Completions"), as emacs normally does for Apropos, Help, describe-function matches, etc. The buffer says "Potential matches: " and displays a lonely single dot.

If I hit TAB a second time, the single dot is replaced with a full list of potential directory matches, and is displayed in the "Ido Completions" buffer as Emacs normally does. Seeing that, I can start typing a desired match, and the minibuffer will eventually match it.

Sometimes if I type a single letter in the minibuffer, and then backspace to erase it, the usual (nice) flex match display shows up, with something like this ../blah/blah/dir/{. | match1/ | match2/ | ...}showing. From this, I'm thinking that ido-read-directory-nameknows how to properly show directory matches in the minibuffer, but for some reason is not doing it by default.

Why doesn't ido-read-directory-namedisplay the possible directory matches in the minibuffer? Is there some variable that I might have set wrong? (I looked at the 50? possible ido-* variables with describe-variable, but couldn't see anything. Ditto for searching the SO forums, and the net.

I love ido-read-file-name, but ido-read-directory seems to exhibit very different behavior for me. Ideas to try, anyone? Thanks

1
  1. For clarification, all you want ido is to present you with possible sub-directory names?

  2. From my interpretation, what you want is ido-dired with C-x d.

This allows you to use dired mode in tandem with ido mode. Here's what that looks like for me when executed in a blank buffer:

enter image description here

After that command, I can navigate around my directories (only, no file names) and choose the directory.

  1. Here's a post on overflow where someone has a problem similar to yours.

The solution offered is one I personally use, which is ido-ubiquitous, a package that attempts to implement ido functionality basically in any buffer possible 'without breaking anything.' It's on Github and MELPA. It is a really powerful package that can do a lot more than what I use it for, so I personally highly recommend it.

Together with normal ido, I am able to have near universal buffer completion with just the following three commands:

(ido-mode 1) 
(ido-everywhere 1)
(ido-ubiquitous-mode 1)

Installing Smex also enhances navigating any M- related commands, and only requires (smex-initialize) and rebinding M-x and M-X.

With a lot of emacs minor and major modes, there are various configurations with minor differences so if you don't choose the right one from the start, it can cause confusion/look like it doesn't work. Additionally, if you try to combine modes that theoretically should work together, it goes without saying that they still might not for obscure reasons down in the code itself. At minimum, I hope this answer put you in the right direction.

  • 1
    Hi Zaile, thank you for taking the time to post a screenshot and suggestions for ubiquitous mode, etc. I've been trying out normal ido before I explore the jumps to icicles, ido ubiquitous, etc. Your screenshot is exactly what I want to see (and expect to see) in the minibuffer. But even using ido-dired, it behaves as I described above. One tab/space shows me a dot in a normal buffer, a second space/tab shows a full list, typing a char and backspacing shows the nice minibuffer list. And I don't want dired, since I'm calling (ido-read-directory-name ...) from code.. Weird behavior. – Kevin May 2 '16 at 3:27
  • (two part comment, part 1) I cannot personally speak for the niche functions of ido-mode because from the get go, I set up my installation with ido-ubiquitous. Similarly, I have never used icicles because ubiquitous has worked really well for me. I understand if you want to work you way up, but, that said, I am ~nearly~ promising you instant results with the set up I use with the catch that there is not something else conflicting in your init file. Opinion aside, ido-mode, according to the GNU manual, was meant for "switch[ing] between buffers and visit files and directories..." – zaile May 2 '16 at 3:44
  • (part two) and what you seem to want is a very specific behavior out of ido. You may very well be able to get it to behave as you want without any additional packages, but searching directories alone was a function dired-mode was kind of build with in mind. That's why C-x d command works as well as it does: that's the behavior it was designed to have. Ultimately, while I can't help you further along what you want to do (and I respect your approach/desired execution), may I suggest you try a temp init file with the configuration I suggested? That way you at least get to try it & see. – zaile May 2 '16 at 3:49
  • Also, I'm glad to have given what advice I had to offer, no problem. I like to help as much as I can. I am pretty new to emacs and I understand how difficult it can be to figure out. That's a characteristic that seems to apply regardless to how experienced some users are and (as I've sort of mentioned), I think it ultimately comes down to the fact emacs has so many modes with so many sub-functions that are easy to forget, conflict, or just misuse. – zaile May 2 '16 at 3:51

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.