0

In emacs I'm already using iswitchbuffer, but I would still like to be more productive with my buffer switching.

One common case which arises a lot is that I have 6 or 7 identical or near-identical file names. For example:

server.py<proj1> server.py<proj2> server.py<proj3>... foo_server.py<proj4>

The problem is that I have to type out most of the directory context when I'm switching buffers.

An existing alternative to typing the directory context is a completion window which pops up saying:e

Click on a completion to select it.
In this buffer, type RET to select the completion near point.

Possible completions are:
... ....

but this is unsatisfactory as well since I have to the switch to the window and use the mouse to pick one.

What I'd prefer is to use tab or some other key to highlight alternative buffer selections, then enter to select one. Is there a way to do this?

daj
  • 6,962
  • 9
  • 45
  • 79
  • 2
    With the way standard completions works, pressing the tab key pops open the window -- the user is free to remain in the minibuffer and continue typing to narrow down the selection, press the tab key again to further narrow down the completions, and press the enter key when the selection is isolated. I use the completions window just as a guide to let me know what's possible, but I rarely ever switch to that buffer to use the enter key on a selection or use the mouse. – lawlist Sep 15 '15 at 22:55
  • 2
    The up/down arrow keys can also be used in the minibuffer to switch between the different choices. – lawlist Sep 15 '15 at 23:17
  • 1
    +1 to both points @lawlist mentioned. There are also lots of completion libraries you can use, to more effectively match and select completion candidates. ([Icicles](http://www.emacswiki.org/emacs/Icicles) is one, but there are plenty of others.) Also, even with vanilla Emacs you can often match the parts of your candidates that distinguish them, thanks to its so-called "pcompletion" matching. – Drew Sep 16 '15 at 00:15
  • thanks icicles does the trick. if you submit that, i'll accept as the official answer. – daj Sep 16 '15 at 01:57

2 Answers2

1

In iswitchb-mode (and its successor1 ido-mode) the default binding for cycling through candidates are Ctrl+s and Ctrl+r.

You should be able to limit your candidates by typing the common bit of the filename then cycle through those candidates with those bindings.

1 See the header text in iswitchb.el and ido.el.

Randy Morris
  • 39,631
  • 8
  • 69
  • 76
0

If you use icomplete-mode (which is a bit like iswitchb-mode but applies to all completions rather than only for buffers), you can cycle to the next/previous matching candidate with C-, and C-..

Another option, if you use the default completion system (with or without icomplete-mode), is to type serv*1 (for example) to select server.py<proj1>.

Stefan
  • 27,908
  • 4
  • 53
  • 82