unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Joost Kremers <joostkremers@fastmail.fm>
To: Adam Porter <adam@alphapapa.net>
Cc: Eli Zaretskii <eliz@gnu.org>, 70664@debbugs.gnu.org
Subject: bug#70664: 29.3; vtable-insert-object cannot insert at top of table
Date: Thu, 02 May 2024 12:12:21 +0200	[thread overview]
Message-ID: <86frv0frp6.fsf@p200300d6272c85ce335985c3abedb491.dip0.t-ipconnect.de> (raw)
In-Reply-To: <6affc493-a048-465d-a237-afa03896d892@alphapapa.net> (Adam Porter's message of "Thu, 2 May 2024 04:54:33 -0500")

On Thu, May 02 2024, Adam Porter wrote:
> To be clear, I don't plan to work on this anytime soon.  :)

No problem. I would kinda like to give it a try myself, but I'm not going to
make any promises, either. :-)

> Beyond that, IMHO it might be good to write a function with a different
> signature that would allow more flexibility, e.g.
>
> (cl-defun vtable-add (object table &key after before at)
>   "Add OBJECT to TABLE at specified position.
> AFTER may be an object after which to insert it; or BEFORE may be an object
> before which to insert it; or AT may be an integer position at which to insert
> the object, 0 meaning first and -1 meaning last (only one of these three
> arguments should be given).")

I personally don't like the "only one of these three arguments should be given"
part (what happens if more than one are given?), so perhaps a different
suggestion:

(defun vtable-add (object table &optional position before)
   ...)

with POSITION being either an object or an integer. If an object, BEFORE being
non-nil would mean "insert before POSITION", and nil would mean "insert after
POSITION"). If POSITION is an integer, BEFORE is simply ignored. (With this
signature, vtable-insert-object could actually be aliased to vtable-add.)

Though I admit your suggestion has the advantage of explicit keywords.

Do let me know which approach you prefer, in case I do decide to give it a try.

-- 
Joost Kremers
Life has its moments





  reply	other threads:[~2024-05-02 10:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30  9:30 bug#70664: 29.3; vtable-insert-object cannot insert at top of table Joost Kremers
2024-04-30 12:18 ` Eli Zaretskii
     [not found]   ` <d55f9a57-c9aa-439e-b8e1-004f445f1a24@alphapapa.net>
2024-05-02  6:52     ` Joost Kremers
2024-05-02  9:54       ` Adam Porter
2024-05-02 10:12         ` Joost Kremers [this message]
2024-05-03  4:16           ` Adam Porter
2024-05-07 10:52             ` Joost Kremers
2024-05-09  8:45               ` Eli Zaretskii
2024-05-09 16:45                 ` Joost Kremers
2024-05-18  8:54                   ` 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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=86frv0frp6.fsf@p200300d6272c85ce335985c3abedb491.dip0.t-ipconnect.de \
    --to=joostkremers@fastmail.fm \
    --cc=70664@debbugs.gnu.org \
    --cc=adam@alphapapa.net \
    --cc=eliz@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).