unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Po Lu <luangruo@yahoo.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Manuel Giraud <manuel@ledu-giraud.fr>,  emacs-devel@gnu.org
Subject: Re: Menu bar items structure
Date: Thu, 17 Nov 2022 16:42:27 +0800	[thread overview]
Message-ID: <87sfiiezv0.fsf@yahoo.com> (raw)
In-Reply-To: <83iljednq6.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 17 Nov 2022 09:49:53 +0200")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Manuel Giraud <manuel@ledu-giraud.fr>
>> Date: Wed, 16 Nov 2022 18:30:58 +0100
>> 
>> AFAIU, those items are stored as a flat array.  So there are many usage
>> of this magical "4" number in keyboard.c and *term.c to walk this array.
>> 
>> So I guess my question is: could (should?) it not be done with a proper
>> struct?  Maybe it is historical or maybe I'm missing something?
>
> I'm not sure how you intended to use a C 'struct' in this case.
> Menu-bar items is a Lisp vector, so how do you replace it with a C
> struct and still allow Lisp to populate a menu?

I suggest not trying to change the internal menu representation.

As it is, it allows easily creating very deeply nested menus, and
garbage collection of menu items "just works".

When working on the Haiku port, I tried to represent the menu bar
contents in some more intuitive format, which led to garbage collection
issues and C stack overflows with somewhat deeply nested menus.



  reply	other threads:[~2022-11-17  8:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-16 17:30 Menu bar items structure Manuel Giraud
2022-11-17  7:49 ` Eli Zaretskii
2022-11-17  8:42   ` Po Lu [this message]
2022-11-17  9:57     ` Manuel Giraud
2022-11-17 10:06       ` Po Lu
2022-11-17 10:09         ` Manuel Giraud
2022-11-17 11:15           ` Po Lu
2022-11-17 11:17             ` Po Lu
2022-11-17 11:16       ` Eli Zaretskii
2022-11-17 15:06         ` Manuel Giraud
2022-11-17 17:01           ` Eli Zaretskii
2022-11-18  7:48             ` Manuel Giraud
2022-11-17  9:23   ` Manuel Giraud

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=87sfiiezv0.fsf@yahoo.com \
    --to=luangruo@yahoo.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=manuel@ledu-giraud.fr \
    /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).