From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: Menu bar items structure Date: Thu, 17 Nov 2022 16:42:27 +0800 Message-ID: <87sfiiezv0.fsf@yahoo.com> References: <87pmdmkdrh.fsf@elite.giraud> <83iljednq6.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24871"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Manuel Giraud , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Nov 17 09:43:29 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ovaUb-0006FU-AS for ged-emacs-devel@m.gmane-mx.org; Thu, 17 Nov 2022 09:43:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ovaU1-0004Cf-Sp; Thu, 17 Nov 2022 03:42:54 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ovaTs-000499-Vj for emacs-devel@gnu.org; Thu, 17 Nov 2022 03:42:46 -0500 Original-Received: from sonic311-23.consmr.mail.ne1.yahoo.com ([66.163.188.204]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ovaTq-0004KA-TY for emacs-devel@gnu.org; Thu, 17 Nov 2022 03:42:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1668674560; bh=Opeq9AOm/Fz9ipL6Ps6+SfQyJ5k+1hEdiCMVddWH7YM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=DSATmUTNTUl7P/aD+wYjdQauUNewsv0G6hRqCG0sroa08zpLnPvxyhm6NWFpPCzcK96M4RylrwkDLZurH7KVMQJmsKYfCCFa2RASbjoJskO8whqPaEs+8sS3kAga3VbQC925ARmrmXsT5wOHkPbiQWsO4UoKmgxwjWAKr0CkLIgJVjAGEdnxikm6EiYZcKAnz1LaMYl6LT6oykEzxEXDOuUXBURL3KbHqhe+Q0Z51ejKBsqffBQH2OOza5DvdEd8D3PxKq05g9UZwkL+PwKRMlRiG/xsD2MIxJnwuHc1Ppu10napg1Na4Dhpf+ue5rxPjks6EDD8NWP/g4+bd04CvQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1668674560; bh=pEyVNQ+7i3DAG7+ZXVuQgXhbAlmLW8KTrQACg3yIK1s=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=mN1seHz/2Z07tZcZ7pZRGpMrnKmqg5XYi+LcPI9//rvKYV+Um8pFt4kySeBu5i3YRxU2lfQXA00qWTvyCUMI0FayHTvT/2xN+szSk3ueSZnLNnKgg6+nMUYfdPRS34GX+T70/BhnIQC2neTwGwL3PyrlFMhIPXjThakv67IsUhAxyZl6hFMeVRx8lBVosbofWJrL05eZqdykZWc8WIVczp1RPl+dO120gHjFzsrvcfwXRFsF9VLoA8m7btvseJAYVTQKX5MQOgsTOQpOonc6wvmNXcD6Sd1kmi3spftg1oBKWIHJZh4spP1XJXL9aTrAUqP5ls4BA59HLKdXdnilaQ== X-YMail-OSG: Qj2xXb8VM1kqz4j6Nx7FYlWLWEoGJLXNnlLeBGd55YKZhitlSOOM0pJULnav9TL 1xXHU__T72ZlDObN99uv3q28dJrWa2984pLuu0Xq2WaUpimlu2igAcRCBfLjGbBnUgu9mJyVUO9T 6SPwJhpTbHOGEhN3TlufaD6YvqttXkSI_8UWlkEmhkJCljnedrRjq17o8H1413eTS8O2sZczNvFv vNUBwubR13xwCkK8k3bAPdHbN6Ez9FeIZoKSniYdKwkncS5FeUIs43p430u.qdtoY8__k9CJgPIb td93a7eDZuUtRMTrHcSwVeeM2rpJudUonrcojaJMUHgJgSP0TA3RJQ8fbPgcAkZ8kgQ2yUbgTXab yWt.pq2XeAkNsggEADqojxJNmn63VfNGkc0Qi3q3L0Klco7JsY7DTp4N8ZDeVRtWuLWWxoGOvLuT OeTvUKRzsDoAW_54krcDjpsh_xbredAVLcEAvwsSHetiJ_kxH8MdrXYXHUC3BKnysGtm_QHydnSX RuTOSak2ylep2EALn1Ve6ZNtIop0ed4XzeiAi9CmfW3e8M0WsEl_jIkbHER6CfqSBn9T0lGbBDEu 0nv_RODdO3u7V7r5wPZaydfVjTS8znOocLPQusvj6VnbpQDA69LKbr0UaqQLHyoeDi7XUQGXfkLk FaaxjpoExLnJILiUU9ZGZnRXBhRUW6LG.ntq7LcYbcnRx012fdEBj7jI6fkANC2s3CccLhou8DKh beV64I8YwV451rdDYpjd__W8k2fEjoMd.MQb4ucLqQOeQ5PoZIJzDWtBOY6BF9yRZIu6wICslJL2 EdpKXKHHk6MUvEXYP.ycHbVun6DT62db4XMevbrriO X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.ne1.yahoo.com with HTTP; Thu, 17 Nov 2022 08:42:40 +0000 Original-Received: by hermes--production-sg3-6c8895b545-zc8w5 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID a3834a9a7fb0f8c37b001ad130f30719; Thu, 17 Nov 2022 08:42:34 +0000 (UTC) In-Reply-To: <83iljednq6.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 17 Nov 2022 09:49:53 +0200") X-Mailer: WebService/1.1.20885 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.188.204; envelope-from=luangruo@yahoo.com; helo=sonic311-23.consmr.mail.ne1.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:300026 Archived-At: Eli Zaretskii writes: >> From: Manuel Giraud >> 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.