GNU bug report logs - #66890
29.1; buffer-size should also accept the buffer's name as string argument

Previous Next

Package: emacs;

Reported by: Daniel Nagy <danielnagy <at> posteo.de>

Date: Thu, 2 Nov 2023 05:54:02 UTC

Severity: wishlist

Tags: moreinfo

Found in version 29.1

Full log


View this message in rfc822 format

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>, Daniel Nagy <danielnagy <at> posteo.de>
Cc: 66890 <at> debbugs.gnu.org
Subject: bug#66890: 29.1; buffer-size should also accept the buffer's name as string argument
Date: Fri, 3 Nov 2023 17:21:44 -0700
Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs <at> gnu.org> 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'.




This bug report was last modified 109 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.