all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Daniel Nagy <danielnagy@posteo.de>
To: 66890@debbugs.gnu.org
Subject: 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	[thread overview]
Message-ID: <877cmzzxf5.fsf@posteo.de> (raw)
In-Reply-To: <CADwFkmnbX6X9T-cz4q_NFot1dZaxpPUY-0WN0r6ZCpMXqUyvXg@mail.gmail.com>

(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





  reply	other threads:[~2023-11-02 20:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-01 16:31 bug#66890: 29.1; buffer-size should also accept the buffer's name as string argument Daniel Nagy
2023-11-02  6:32 ` Eli Zaretskii
2023-11-02 19:38   ` Stefan Kangas
2023-11-02 20:55     ` Daniel Nagy [this message]
2023-11-03 13:38       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-04  0:21         ` Stefan Kangas
2023-11-04  6:03           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-04 10:43             ` Stefan Kangas
2023-11-04 20:57         ` Daniel Nagy
2023-11-04 22:12           ` Drew Adams
2023-11-05  5:35           ` Eli Zaretskii
2023-11-05 23:02           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found]     ` <87bkcbzy6c.fsf@posteo.de>
2023-11-03  6:46       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877cmzzxf5.fsf@posteo.de \
    --to=danielnagy@posteo.de \
    --cc=66890@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.