3

Q: how do I switch to a new buffer with ido without needing to confirm?

I open up a lot of temporary buffers to do scratchpad work. When ido-switch-buffer can't find a match for the buffer name I'm entering in the minibuffer (because, as per use case, it's a new one), it asks me to confirm that I really wanted this unknown buffer. I'd rather not have that extra step (admittedly small) to break my concentration.

I presume there is a setting I'm missing, but how do I turn off the "confirm" query?

2 Answers 2

7

Found the answer to this question with some additional digging, but I'll leave it up in case others have this question in the future.

The variable in question is confirm-nonexistent-file-or-buffer. It looks like the default is after-completion, but setting it to nil turns of the confirmation request.

The variable is relevant not just for ido and family, but also for a wider range of functions like switch-to-buffer and find-file. Rather than change the default everywhere, we can turn off confirmation for just this one functionwith a little bit of advice:

(defadvice ido-switch-buffer (around no-confirmation activate) (let ((confirm-nonexistent-file-or-buffer nil)) ad-do-it)) 
1
  • Works fine, even with flx-ido and ido-ubiquitous. Commented Nov 19, 2014 at 18:32
3

Set ido-create-new-buffer variable to (quote always) using customize, or by adding (setq ido-create-new-buffer 'always) to your init file.

6
  • Unfortunately, that doesn't seem to work for this issue. Even with ido-create-new-buffer set to 'always, I still get the confirmation query. Commented Oct 23, 2014 at 15:11
  • 1
    Odd, it definitely fixed the problem for me; see also masteringemacs.org/article/introduction-to-ido-mode for reference, and other ido trickeries. Commented Oct 23, 2014 at 15:12
  • That is odd, because the use-case described in the link you cited is pretty much exactly what I was going for. Looking back at my init file, I'd actually tried that a while back and have a note-to-self that it didn't work. One untested possibility is that something about flx-ido and/or ido-ubiquitous, both of which I use, is interfering. Commented Oct 23, 2014 at 15:14
  • Yeah, I use this approach as well. Must be some other aspect for your configuration in play here. Commented Oct 23, 2014 at 17:26
  • 1
    I spoke too soon.. Just trying with a clean 24.4 instance and see what @Dan reported. It turns out I had previously set confirm-nonexistent-file-or-buffer to nil. If you do that there is a different confirmation prompt from ido, which you can avoid with ido-create-new-buffer. Commented Oct 23, 2014 at 17:49

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.