0

Emacs has recently (between 24.0 and 25 ish?) removed iswitchb in favor of some combination of ido and icomplete mode, which I've seen claims are 99% compatible; which I can live with, I don't have any sort of fancy custom hooks or anything just a few excludes here and there. But I can't seem to figure out how to make the "new" modes work the way iswitchb did.

When trying to open a new file with C-x f or C-x C-v I often get stuck with extra garbage on one or both ends of the path I'm trying to navigate to, (either the path prefix is in a weird green mode and behaves oddly when trying to navigate or edit characters or text persists to the right of the point and interferes with suggestions. Or at times I only get suggestions for directories even when there are files present (I have multiple times had to type the entire path and file name and hit enter to open a file as it wouldn't complete at all).

So how do I get the iswitchb style behavior back?

Here's a specific repeatable occurrence of one problem: I have a file open in a buffer, and hit C-x C-f to find a new file, the path to the buffer's current file's directory is pre-filled in the mini-buffer and is the colour of the mini-buffer prompt instead of the colour of the text you type (green instead of white for me), if I paste/yank/whatever in a relative path, the new text is white and ido (or icomplete or whatever is handling the completion in this case) cannot find the file. What's more; often there is some overlap at the end of the pre-filled portion of the path and the new text added, so I need to edit at that point, however pressing alt-b deletes directories off the end of the pre-filled section instead of moving the point and the new text is lost too.

eg:

  • open file at ~/Developer/lisp/cool_file.el
  • copy the path to another file in another terminal tab or where-ever. eg: ruby/other_cool_file.rb
  • press C-x C-f in emacs to find a new file
  • the mini-buffer will show the following: Find file: ~/Developer/lisp/ in the mini-buffer's "prompt" colour
  • paste in the new path Find file: ~/Developer/lisp/ruby/other_cool_file.rb [No match]
  • the pasted path will be the regular colour of mini-buffer input and the file will not be found even if the path is correct as is. (hitting return will clear the pre-filled path completely and replace it with the pasted path, which won't find anything either.
  • if there needs to be some change made at the point between the two styles of text in the mini-buffer, pressing alt-b to get to that point will not move the point as expected but instead remove the rightmost prompt-coloured directory from the pre-filled path and delete the new path that you pasted in.

Obviously I'd like to have the file be found when the path is correct as entered and be able to navigate the mini-buffer as normal.

5
  • Can you please give a concrete example of the difficulties you see? I'm guessing that might help people help you with this.
    – Drew
    Commented Sep 29, 2016 at 0:00
  • Is my second paragraph not concrete enough? How could it be improved? Commented Sep 29, 2016 at 1:38
  • 1
    Try to provide a step-by-step recipe (from emacs -Q) to reproduce the behavior. State what you see at each step and what you expected to see instead. Show the path you are trying to navigate to and the resulting "extra garbage", with the "weird green mode". Describe what you mean by "behaves oddly" and just how you are trying to navigate or edit characters. Show the persisting text to the right of point, and describe how it "interferes with suggestions". Show the "suggestions for directories". Etc. Some of us have used IswitchB, Icomplete. and Ido. I, for one, do not follow you.
    – Drew
    Commented Sep 29, 2016 at 3:38
  • Read the NEWS (C-h N): iswitchb was not removed (yet), it's only been declared obsolete. In the case of packages it implies they're not autoloaded any more, but they're still there. You just need to (require 'iswitchb) explicitly.
    – Stefan
    Commented Oct 3, 2016 at 1:04
  • I had iswitchb required in my init.el and it failed saying that the package could not be found. Commented Oct 3, 2016 at 4:05

1 Answer 1

1

Ah, I see what's going on. Almost everything you describe is normal and desirable behavior for ido-mode, which makes it hard to see what bug you're reporting.

However, I think I've replicated it. I already had a file from the Emacs source code open (src/xterm.c), so I started with that. I tried opening two README files in different locations using the method you describe; one was src/README and the other was lisp/README. First I tried to open lisp/README by pasting in the string "../lisp/README", and it didn't work; it said that the file wasn't found. Then I tried pasting in just the string "README", and that did work; it successfully opened src/README. This seems to be the bug that you're hitting; I surmise that when you paste in something with a path separator in it it breaks. To double check that it's not happening simply because I pasted in a "..", I also tried opening src/bitmaps/README by pasting in the string "bitmaps/README". This didn't work either, which seems to be pretty conclusive.

I would use M-x report-emacs-bug to send in a bug report about it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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