[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rename buffer but overwrite already existing one

From: Stefan Monnier
Subject: Re: rename buffer but overwrite already existing one
Date: Mon, 23 Mar 2020 14:23:55 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> Couldn't rename-buffer, optionally, overwrite the content of a buffer.

Yes and no: it depends on what you mean by "overwrite the content of a buffer".

Here's what I think could be done easily:

- say you have buffers "mybuf" "otherbuf"
- you're in "mybuf" and you do `M-x rename-buffer RET otherbuf RET`.
- Emacs currently refuses it but it could accept your command by
  first renaming "otherbuf" to "otherbuf<1>", or by killing "otherbuf",
  or by asking you for a new name to use for that other buffer.

But the two buffers can be unified into a single one.

Of course, another option might be to tweak `rename-uniquely` so it
automatically chooses a more informative name than what you get by
adding a "<N>".  I think such a feature might be a good idea
in general.  E.g. we could add a variable `buffer-name-suffix-function`
which some major modes could set to provide "meaningful" unique names.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]