1

When creating a new buffer via:

  1. C-x b
  2. NonExistentBufferName RET RET

I would like Emacs to prompt me for the major mode this buffer is going to use upon opening. Moreover, I want Emacs to infer the major mode in some cases based on the buffer's name:

  1. C-x b
  2. test.org(no such buffer/file so far) RET RET => org-mode is used without asking me anything.

Could anybody advice on how I can achieve this? Package or, probably, just pure elisp with its hooks and advice?

P.S. I'm using ido if it matters.

3

I know this is not exactly what you're asking, but the Emacs way to solve this problem is to use C-x C-f instead of C-x b (if you don't want to create a file, just don't use C-x C-s in that buffer).

  • Thanks, @Stefan, for such a prompt response. Yeah, that seems to be a solution. I was a bit worried about the scenario when I finally decide to save that buffer. If it is already associated with a path and I want to change the final location, it is a problem. But seems like C-x C-w solves this problem. – Dmitry Senin May 11 at 20:30

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.