From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel,gmane.emacs.orgmode Subject: Re: [RFC] The best way to choose an "action" at point: context-menu-mode, transient, which-key or embark? Date: Mon, 16 Dec 2024 09:46:07 +0200 Organization: LINKOV.NET Message-ID: <8734io3xyo.fsf@mail.linkov.net> References: <8734m28l9a.fsf@gmail.com> <87y120daue.fsf@localhost> <874j4m9ep6.fsf@gmail.com> <87h68gfqj1.fsf@localhost> <87pln3f3cc.fsf@localhost> <87jzd9ojj0.fsf@localhost> <87cyj0ajm9.fsf@gmail.com> <87zfm4s50x.fsf@localhost> <87wmh8s358.fsf@localhost> <87y11nwp9z.fsf@gmail.com> <87v7wd9a2h.fsf@localhost> <878qt7fbki.fsf@gmail.com> <87o71jwdxz.fsf@localhost> <87wmg6edr0.fsf@gmail.com> <87msgzh1dh.fsf@localhost> <87frmq6ufj.fsf@mail.linkov.net> <87zfkx1fha.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21994"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) Cc: emacs-devel@gnu.org, emacs-orgmode@gnu.org To: Ihor Radchenko Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Dec 16 09:00:27 2024 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 1tN61i-0005c9-RT for ged-emacs-devel@m.gmane-mx.org; Mon, 16 Dec 2024 09:00:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tN60v-0007UI-EP; Mon, 16 Dec 2024 02:59:37 -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 1tN60o-0007Th-IK; Mon, 16 Dec 2024 02:59:31 -0500 Original-Received: from relay3-d.mail.gandi.net ([217.70.183.195]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tN60l-0007oU-3V; Mon, 16 Dec 2024 02:59:30 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 4A53D60003; Mon, 16 Dec 2024 07:59:18 +0000 (UTC) In-Reply-To: <87zfkx1fha.fsf@localhost> (Ihor Radchenko's message of "Sun, 15 Dec 2024 09:07:45 +0000") X-GND-Sasl: juri@linkov.net Received-SPF: pass client-ip=217.70.183.195; envelope-from=juri@linkov.net; helo=relay3-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham 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:326544 gmane.emacs.orgmode:164180 Archived-At: >>> 1. List of possible actions: ((name1 . action1 props) (name2 . action2 ...) ...) >>> PROPS is a plist defining extra properties like key-binding, display >>> string, maybe something else to be used in the future. >>> 2. Menu interface to use (transient, context-menu, embark, which-key) >> >> This looks like the best design. Any part of the org buffer could have >> text properties with a list of its available actions. Such a property >> could be similar to 'context-menu-functions' handled by 'context-menu-map'. >> But since it will be a plain generic list, it could be transformed to any >> menu interface such as transient, context-menu, etc. > > I am a bit lost. > Maybe I did not describe the use cases I had in mind well. > > What I have in mind is a menu UI for various commands: > 1. org-open-at-point (one set of actions) > 2. org-ctrl-c-ctrl-c (another set of action) > 3. some other command > 4. ... > > Then, "actions" will be various options a given command can do. > > In such scenario, the usefulness of text properties is elusive to me. > I'd rather link the menu items to a command, not to place in buffer. Indeed, in this case text properties are not needed. Then you can use something like the buffer-local variable with the same name 'context-menu-functions' (handled in 'context-menu-map'). The main point is that these functions return a menu. But instead of a menu, an org function could return a more high-level data structure like ((name1 . action1 props) (name2 . action2 ...) ...) IOW, this means adding an abstraction layer on top of the existing user interfaces such as transient and context-menu. >> To transform it to context-menu, org-mode should provide a function >> like 'context-menu-minor' that will create a corresponding menu >> that will be added as a submenu of the default context menu. >> >> Such integration with existing menus would be better than the current >> implementation of context menus in org-mouse-context-menu that completely >> replaces the context menu with its own. > > What do you mean by "default context menu"? The default context menu is the menu constructed from many different context-menu functions. Some of them add Undo/Redo entries, some add Select/Copy/Paste, some add Global submenus, etc. I meant to keep all these existing menu items, and also append the submenu items returned by Org-mode.