Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I rename a buffer to a similar name

Tags:

emacs

This happens frequently to me: I am using several M-x shell shells at the same time. To open the next shell, I have to rename the first one with rename-buffer. However, emacs simply then prompts the new buffer name without permitting me to reusing the existing buffer name to construct a related one like *shell* dist in place of *shell*. So how can I write the new name without retyping everything?

like image 886
false Avatar asked Dec 16 '22 02:12

false


1 Answers

Note also C-hf rename-uniquely

So one option is:

  • M-x rename-uniquely RET
  • M-x shellRET

However for this specific use-case, you can circumvent a renaming step entirely by using a prefix argument when you invoke the command: C-uM-x shell

Obviously this all depends on whether you're happy with the automated name, or if you wanted to name it something more meaningful. If the latter, than the answer by false is clearly going to be the most useful (probably in conjunction with the prefix argument approach).

like image 82
phils Avatar answered Dec 21 '22 01:12

phils