Subject: bug#66890: 29.1; buffer-size should also accept the buffer's name as string argument

From: Stefan Kangas <[email-masked]>
Date: Fri, 3 Nov 2023 17:21:44 -0700

Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <[email-masked]> writes:

> I do have an opinion on this: I wish I could go back in time and get rid
> of this `buffer-or-string` business altogether.
>
> The reason is that I've seen several ELisp packages which abused buffer
> names as "handles" for buffers, leading to nasty bugs when those buffers
> get renamed (e.g. by things like uniquify).

I'm not sure which way to lean here: writing ELisp customizations is
easier for regular users if these functions accept either buffer or
string.  It's also less verbose.

OTOH, perhaps you're right that it's just too brittle.

Do you have some sense for how common that class of bugs are?
My guess is that we have a few of them in our tree, too.

> It's not important enough to motivate making backward
> incompatible changes.
>
> Maybe we should just "de-emphasize" the fact that those functions also
> accept strings, and instead insist that you have to go through
> `get-buffer` (or `get-buffer-create`).  If that sounds vague and you
> don't know what that would mean concretely, well.. you're not alone :-)

Perhaps we could recommend against abusing it in `(elisp) Tips'.