From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Tor=2Dbj=C3=B6rn_Claesson?= Newsgroups: gmane.emacs.orgmode,gmane.emacs.devel Subject: Re: [RFC] The best way to choose an "action" at point: context-menu-mode, transient, which-key or embark? Date: Sun, 22 Dec 2024 14:16:20 +0200 Message-ID: References: <8734m28l9a.fsf@gmail.com> <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> <8734io3xyo.fsf@mail.linkov.net> <87ttb3cxk5.fsf@localhost> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000a563ed0629dad93c" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4967"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Juri Linkov , emacs-devel@gnu.org, emacs-orgmode@gnu.org To: Ihor Radchenko Original-X-From: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Sun Dec 22 13:17:09 2024 Return-path: Envelope-to: geo-emacs-orgmode@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 1tPKtR-0001AT-Ot for geo-emacs-orgmode@m.gmane-mx.org; Sun, 22 Dec 2024 13:17:09 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tPKsw-0008Bz-D3; Sun, 22 Dec 2024 07:16:38 -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 1tPKst-00087p-U5; Sun, 22 Dec 2024 07:16:36 -0500 Original-Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tPKsr-0001Rr-U7; Sun, 22 Dec 2024 07:16:35 -0500 Original-Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-5d41848901bso6357849a12.0; Sun, 22 Dec 2024 04:16:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734869792; x=1735474592; darn=gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=R6OEcQVvOTUPDR35W16UdJVcu/5jakmN3Vwh8uvjXGY=; b=ND/kghzMJQe0nGx5zHkxqedifXjWkxg75cLCo5P8+PY/+z5AFZTE1N5LAkQrroEqwk govhpRuv6Fo2VlRUZ4ins7Hi87Q67bAVYE1fdIQlLu2tLq/wm/vi4XMqZbIyX0GUBMU4 jnRyTwRjhNI/SSUSQym32OxQgGyC2KV93sqNz059WjAcwm51Y3UEwYXPVmofH15e9evI DlBQKmX9OFgDPuFVYRI4HTvUIHHdjMJfTdMAYVQ/V74PbgjsSdMUiFdy2tUOPA5j5FsT ZoKcyHeqqNnQ2S2Ljn1SFveN2Fo7+78DyT++DYGmZr1B9uXclA1g6QnVCXU6tGcFzp+Y 7QEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734869792; x=1735474592; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=R6OEcQVvOTUPDR35W16UdJVcu/5jakmN3Vwh8uvjXGY=; b=fsYSksztSDk6Sef0doZTH46wtodg8+yd1jQe6uCcQBVNEGkhiZrKRuu2gtaR1fOHVX WgwtFpRRXnIqztyFTm+As1sF5L99ajigaSLDGRIzs1WoKzTn1qT8zxKFhX4RDFlMyA+2 UZ88dft7J99itpUzMZxcCjjGXCs8bH6z5PFIcxUqJUYjz+/U60/LPx7/ZvvQIP43ac3Q I+ZZlhsjzXmahurdamapM8Sld47BTh23ZFdVUiBnz/cIrvm0/ywci9fJSjZXEB0OD+/V g18mDyAkEWfk1R8/C81YfkPMMc0F4fh2PUh2m2nYVX9TWLIoBNZS//8Os/5VAAtrZvRa hISQ== X-Forwarded-Encrypted: i=1; AJvYcCW33yTjxJIh2xh+qqgtwknyRpuOvzL13lLak7uHjqgexsjnkKEBBh+oYXZC/IIv5pTo068JiVgF1MeG9n/VGw==@gnu.org, AJvYcCWnZYcCCjejKt1JORkboyhvjdFd0D/gR7SXAa+5J6Hc2pY4dWjNlAJwSboQ1wZtlSLMfUJ/4WsRLZAlBQ==@gnu.org X-Gm-Message-State: AOJu0YxVhuDGa7ZTKT3N7ilVH+8B5A3zJNcDN526GSH5J3/qG8oKCrwz FiBnUn03onZCJWuSFmPPA2J40h94QTJWuaiDxTWosTphPsXL9WIUdnBWknTdzrc3fEV4nlenCot lIBhqaP0H+P7jkpIT9dh2VTRGXr8= X-Gm-Gg: ASbGncsrMwIcM9kstk3BeRl7rk0lrUkwJpbS8nZyn3Ria0e5nuKOgCDEAX/GPsCqm2U 5CglNtuMW07pgSlCidiBRf/P+RWGIjDkAvt636Dc= X-Google-Smtp-Source: AGHT+IEXBGhShxxjilbGMC0yozhqIz/HX4zXTh23NSlc0JEN5uyK7gbwuhoeEFvIvT+jUf+MVQQO1Dmqoep1FDwPJzE= X-Received: by 2002:a05:6402:3204:b0:5d0:e9a8:4c96 with SMTP id 4fb4d7f45d1cf-5d81e7506bcmr8219398a12.9.1734869791365; Sun, 22 Dec 2024 04:16:31 -0800 (PST) In-Reply-To: <87ttb3cxk5.fsf@localhost> Received-SPF: pass client-ip=2a00:1450:4864:20::536; envelope-from=tclaesson@gmail.com; helo=mail-ed1-x536.google.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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Original-Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.orgmode:164305 gmane.emacs.devel:326850 Archived-At: --000000000000a563ed0629dad93c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi! Thanks all for the great discussion! Just so I understand: we are talking about simple cases of offering multiple actions (possibly on objects), and not more complex things such as the export menu, with async options etc= ? > Tentatively, I am thinking about the following: > > For a given Emacs "prefix" command (e.g. org-open-at-point), we define a > set of customizations: > > 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) > 3. Layout settings for the specific interfaces. For example, transient > layout definition. Do we need 3? Could we decide on a way to specify layout properties in props? We could have e.g. a group name which would translate to a transient column= . The citation follower prototype works similarly to right click menus of mainstream desktop environments - i.e. it allows the user to optionally select an alternative action while providing a default. You "right click" by -4 prefix, and can also invert this behavior to show the menu by default, and invoking the default action if called with a -4 prefix. Den m=C3=A5n 16 dec. 2024 kl 20:06 skrev Ihor Radchenko : > > Yeah. I am not 100% sure if adding an abstraction layer is a great idea. > Another idea I was considering is similar to what you propose: have some > kind of hook like `context-menu-functions', but accepting an extra > argument - menu type (context menu, transient, which-key, etc.). Then, it > should produce appropriate menu spec. > > However, this will require Elisp to customize things. Also not ideal. > My naive take: Should we make a macro for creating this kind of simple menu? It would take a name, a docstring, parameters passed to the action, a default action name, and a default list of actions. It would then create 1. a function that invokes the menu, passing the parameters. 2. a customization group with options for: 2.1. the actions list. 2.2. the default action. 2.3. whether to show menu by default (or by -4 prefix) 2.4. the menu system to invoke (default transient)? 3. a transient menu. Does this sound reasonable? I probably miss something. I would be happy to try to make this, but am a bit swamped with the holidays, so it would have to wait a bit. Cheers, Tor-bj=C3=B6rn --000000000000a563ed0629dad93c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi!

Thanks all for the great= discussion!

Just so I understand: we are tal= king about simple cases of offering multiple actions (possibly on objects),= =C2=A0
and not more complex things such as the export menu, with = async options etc?

> Tentatively, I am thin= king about the following:
>
> For a given Emacs "prefix" command (e.g. org-open-at-point),= we define a
> set of customizations:
>
> 1. List of possible actions: ((name1 . action1 props) (name2 . action2= ...) ...)
>=C2=A0 =C2=A0 PROPS is a plist defining extra properties like key-bindi= ng, display
>=C2=A0 =C2=A0 string, maybe something else to be used in the future. > 2. Menu interface to use (transient, context-menu, embark, which-key)<= br> > 3. Layout settings for the specific interfaces. For example, transient=
>=C2=A0 =C2=A0 layout definition.

Do we need 3?= Could we decide on a way to specify layout properties in props?
= We could have e.g. a group name which would translate to a transient column= .
=C2=A0
The citation follower prototype works similarl= y to right click menus of=C2=A0
mainstream desktop environments -= i.e. it allows the user to optionally=C2=A0
select an alternativ= e action while providing a default.=C2=A0
You "right click&q= uot; by -4 prefix, and can also invert this behavior to show
the = menu by default, and invoking the default action if called with a -4 prefix= .

Den m=C3=A5n 16 dec. 2024 kl 20:06 skrev Ihor Radche= nko <yantar92@posteo.net>:=

Yeah. I am not 100% sure if adding an abstraction layer is a great idea. Another idea I was considering is similar to what you propose: have some kind of hook like `context-menu-functions', but accepting an extra
argument - menu type (context menu, transient, which-key, etc.). Then, it should produce appropriate menu spec.

However, this will require Elisp to customize things. Also not ideal.

My naive take:

= Should we make a macro for creating this kind of simple menu? It would take= a name, a docstring, parameters passed to the action, a default action nam= e, and a default list of actions.

It would then cr= eate
1. a function that invokes the menu, passing the parameters.=
2. a customization group with options for:=C2=A0
2.1. = the actions list.=C2=A0
2.2. the default action.
2.3. w= hether to show menu by default (or by -4 prefix)
2.4. the menu sy= stem to invoke (default transient)?
3. a transient menu.
=C2=A0
Does this sound reasonable? I probably miss somethin= g. I would be happy to try to make this, but am a bit swamped with the holi= days, so it would have to wait a bit.

Cheers,
Tor-bj=C3=B6rn
--000000000000a563ed0629dad93c--