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


Message #16 received at 66890 <at> debbugs.gnu.org (full text, mbox):

From: Daniel Nagy <danielnagy <at> posteo.de>
To: 66890 <at> debbugs.gnu.org
Subject: Re: bug#66890: 29.1; buffer-size should also accept the buffer's
 name as string argument
Date: Thu, 02 Nov 2023 20:55:55 +0000
(resending only to debbugs.gnu.org because my previous mail had delivery
problems)

These are the additional functions/macros, that I found using `M-x
apropos-function', that accept both types of arguments:

    `buffer-hash'
    `buffer-match-p'
    `buffer-text-pixel-size'
    `bury-buffer'
    `display-buffer'
    `get-buffer-create'
    `get-buffer-window'
    `get-buffer-window-list'
    `kill-buffer'
    `pop-to-buffer'
    `project-display-buffer'
    `project-display-buffer-other-frame'
    `project-switch-to-buffer'
    `replace-buffer-in-windows'
    `set-buffer'
    `set-window-buffer'
    `switch-to-buffer'
    `switch-to-buffer-other-frame'
    `switch-to-buffer-other-tab'
    `switch-to-buffer-other-window'
    `tab-bar-get-buffer-tab'
    `temp-buffer-window-setup'
    `window-normalize-buffer'
    `window-normalize-buffer-to-switch-to'
    `with-current-buffer'
    `with-current-buffer-window'
    `with-displayed-buffer-window'
    `with-temp-buffer-window'

The number of functions, that only accept a buffer is vast and probably
outnumbers that list above, so I am not going to list them here.

These are some disadvantages of such a change, that come to my mind:

    1. Could the acceptance of a string in that place of the argument
       prohibit possible future possibilites?

    2. Does the newly accepted argument type sacrifice function purity
       and/or side-effect-freeness?

    3. API inconsistency.

    4. Slightly increased code complexity, especially in the C part of
       the code base.

My commentary in this particular case would be, that I dont see how now
accepting strings in addition would shadow any future usage of that ( or
other ) functions. Neither do I see how it would break function purity
or side-effect-freeness, but that could just be my lack of imagination.

As for the advantage my main argument would be convenience. It does
reduce user's elisp code and and makes smaller evaluations in the
minibuffer easier to type.

I wanted to file some more of such polymorphism suggestions. Would those
be welcome?

--
Daniel Nagy




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.