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

From: Drew Adams <[email-masked]>
Date: Sat, 4 Nov 2023 22:12:50 +0000

My 2c, FWIW -

Things don't have to be all-or-nothing.  A general
principle or approach is one consideration.  But
there can be others.

Stefan mentioned, I think, some specific contexts
where it makes little/no sense to accept a buffer
name in place of a buffer, as an argument.  Fine.
The doc should anyway make clear whether an actual
buffer is required.

There are other (maybe most?) contexts where it
can make sense to accept either one.

Please take a look at vanilla library bookmark.el.
I'm not saying that things are equivalent.  And
bookmark functions constitute a more isolated
context than buffer contexts - the latter are more
numerous and more variable.

But FWIW, bookmark.el functions used to accept
only a bookmark as argument.  Over time they were
systematically changed to accept either a bookmark
name (a string) or a bookmark (a list structure).
___

(This wasn't influenced by Bookmark+, BTW; it has
nothing to do with me.  And in Bookmark+ I prefer
to use the less cumbersome arg name BOOKMARK
instead of the name BOOKMARK-NAME-OR-RECORD, even
when the arg can be either a name or a bookmark.)
___

Similarly, vanilla Emacs used to use the arg name
BUFFER everywhere (whether or not a name was also
allowed), and in many places that was changed
over time to BUFFER-OR-NAME.  That there might be
more places where it makes sense for a function to
accept either seems reasonable.  That functions
should be considered individually also makes sense.

Should `buffer-size' allow a string argument -
that's the question raise here, no?  And Eli asked
the more general question of "whether it is worth
our while to convert more functions to accept both
buffers and names of buffers."  Whether you look
at one or several functions at a time, each should
be considered individually.
___

(Again, to me, the arg name BUFFER is preferable,
as long as the doc string makes clear (which it
really needs to do anyway) that either a string
or a buffer can be passed as arg.  But I'm not
suggesting that Emacs should change its naming
convention (again) in this regard.)