From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id sEakAOXlt2LhWQAAbAwnHQ (envelope-from ) for ; Sun, 26 Jun 2022 06:51:49 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id oLWLAOXlt2IbqgAAauVa8A (envelope-from ) for ; Sun, 26 Jun 2022 06:51:49 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8638A2CEA4 for ; Sun, 26 Jun 2022 06:51:48 +0200 (CEST) Received: from localhost ([::1]:45978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5KFP-0003DL-5R for larch@yhetil.org; Sun, 26 Jun 2022 00:51:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45204) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5KEX-0003DA-Kp for emacs-orgmode@gnu.org; Sun, 26 Jun 2022 00:50:53 -0400 Received: from mail-oln040092069041.outbound.protection.outlook.com ([40.92.69.41]:58922 helo=EUR02-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5KEV-0001JE-6Z for emacs-orgmode@gnu.org; Sun, 26 Jun 2022 00:50:53 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U2RrbCoPZhOv/u0XU5X+f9e82i1uxibrFMXcDjBElG/cXp3R+j5zrN7zaiBT0XWgd0H2I8aBylgLtPZx0MvLKtfTSqRDs+LaZjZiU5Ioxvo72Xr4CRN4nWOIelHwIqSCbpptMF0zxTPcjhNzusqXMki/rahTwor8aCpRCf4u08mE+hYS+ta7y1hngoP8Oqpl91/bRPZClLz74wKAj5h3/w+EKqWAolxWjsxVI0SsdCzlOTdDIKEk+ccWLtxd3omp9OYXdXb8INFxaHkjip7TVb1CB7Stm5txAvJwzQiZJogFtAuJHKdfwOntQGLXxBBHiunT2yGt6MhlzpqyhVKFQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4C3BYoO5XBEdhu9gBtClq26WzoyQVHPGolKZfOs6pCk=; b=gpTnS9ip2gKoBmMfJiqSjwJo8hw5DVe/xgqNE2c6K0Q0YQ5+hOV+0FjD5emxukXSqn6wIB80FTjzMGT2yZJvzQpSmD4CyZS2E2wdmAbEqf31o3RyFsgkSf+1RIUD/uCTau5qBglioEToLEt8NqAInnch93wt/0Bo8SIHNAoKPVb/k2x30L3HStgLxLkFlzofsaVhdtiJ+UASEnRG6GoIYTT2zsbRxa6Q+3o3vCbqnVbVT8hooWPsOy7Seeb3ClXWOya7hSYn7kSVeyVVOw1tItTUOEMYryOaCtqsLtK28L5YTC0emWn8J+SYbGC96/xQ2Ks+FzbwsNOg9ley9bnLBA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4C3BYoO5XBEdhu9gBtClq26WzoyQVHPGolKZfOs6pCk=; b=Sx3WI6Dfz82GTLUtkpQYFkdtER06E+iE2vwDurFFr7rie0P/riUGLLWm1Ts0+0zbqpgLeLvUBujzcxxv5th2EuloZz6x4PCfU5SF3xofwhnRjpqAQ8t9PnA4XnLRYj5z+ff4E9OCRt2Wa5iNx6lDvRVJuPyYX3raIyo9ytfKLo760rKBqoW8s1Ipbj7F3at7gC2PvJMfmnH+MyBLcq3R+oerg9TUjFS/vnyMFLWgsZum8YBz/SPYARj/xrC7qovnkmDldpceDEHZ2eLq9VxsvI/zMP0Mmhto/iouZq2VXvOoeAiWMej5N0jCi89cIgui2sbsv3K/MJ550yg8mrM9gw== Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) by AM0PR09MB2625.eurprd09.prod.outlook.com (2603:10a6:208:e1::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.18; Sun, 26 Jun 2022 04:50:48 +0000 Received: from AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::1995:84ad:afa1:1f39]) by AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::1995:84ad:afa1:1f39%7]) with mapi id 15.20.5373.018; Sun, 26 Jun 2022 04:50:47 +0000 From: Arthur Miller To: Max Nikulin Cc: emacs-orgmode@gnu.org Subject: Re: Proposal: 'executable' org-capture-templaes References: <87fskrobiw.fsf@localhost> <87a6ay1enh.fsf@localhost> <87edzvdb44.fsf@localhost> <878rpu5qf4.fsf@localhost> <87zgi7357y.fsf@localhost> <875ykuslpx.fsf@localhost> Date: Sun, 26 Jun 2022 06:50:46 +0200 In-Reply-To: (Max Nikulin's message of "Wed, 22 Jun 2022 23:29:10 +0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (windows-nt) Content-Type: text/plain X-TMN: [XEd+rXkr/Qb/4/SjMHJEoZchZh5UieOU] X-ClientProxiedBy: GV3P280CA0061.SWEP280.PROD.OUTLOOK.COM (2603:10a6:150:a::28) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <82o7ygqb89.fsf@live.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bfb21ee5-09e1-49a5-48db-08da572f6fb7 X-MS-TrafficTypeDiagnostic: AM0PR09MB2625:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cayHMGZqhlqVRhj2I+VCuN33kLsIYqgUtskVe58SP4e5/uIgircKadJobuzqOfN1XKfnAFgK9CkaCH7TSjs8eK0LiDvdkshOSv4DqiRupRD2zo1x1yI/DyOhGgiWLUBk30+aUAKWYNP+QjesPViv5x3JW83YGDx1VnrrAaypc2/bNRbVv5p9wNMu7KM6gnKgpyF59mijZUNs35UnEkPUDzP+g3SlpAgNtnfzKZbB8Qao7l582JGqsHvzW4Lp+x3tTeVPUD8wwHykUOIYZ0CLGcujGKnyY8Sv2DoWBab+NtrSReeVINVtw9PX7ZdJQ3LuXb59veWAMFX6i+b9nUOl7RQ6CV6wzm+pprOFriNsEpU4p23pOezW5/t9qzPd78Y3EdgPkxE1xjryQ8aI3n0AlD0qoCjrs2Z097zL3yT/MeHxR9p9D5RzZV8qJIFujPVadrn9soq1VpDYr9gHacKATcPAVvgRU7ZZkbcXykGKoZ6VJ48oZeie/v8c2ATopbbAkGljfvNDM1e6Lt96TiXg+xXqOgDkqeGKhGYuKKxEYW0zweEUfyaiUwl/NWiFY2PT+E+XrTAvv8Wm7NGxD4jpxnSAL1pYnhdlW9xek620s5P6KqPlEtqyoOY1wXxjkF8I X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?qykz8A9N7vZ+La8T2NdtZ/RsXymX3UzeCM6yF9CXwsUoDepUqBwnhfpAkOcc?= =?us-ascii?Q?Z6cyt9OxNSoyowLMZBHT0N/FzGsnNZG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JB?= =?us-ascii?Q?F14IhUzSMwcLOQL4FdWsGgmwvilRUvvkVF1Wgg0vErzWjB+ES28t/hF1NHhd?= =?us-ascii?Q?2IZUqkq6VCEeUdSP+Lu05Gx/pyqQqPbIRuZ2V3gttLzS8ZS2BXYUEY1Jn8rJ?= =?us-ascii?Q?nXRuSXJM4gcK7nPJF5VLuD7/osW1dOlOc4mHsSLcvfEv6/hMe+LWyghFQKv1?= =?us-ascii?Q?sMbqDTQDWvndNiEnhhe8gGpbgP74/957uZKqAWUmDsYXpB3o0QK0EDs8vIKy?= =?us-ascii?Q?q8BjzO7LFrdubGhP8Ixnf9nEktFaKEKVGph2P3GsA6DDNc8qSDtQRl4Ug2v+?= =?us-ascii?Q?TLvP8sEiRChwrPrfDtApaIwkcXBvGiVUqHcnQ/gojw=3D=3D?= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-64da6.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: bfb21ee5-09e1-49a5-48db-08da572f6fb7 X-MS-Exchange-CrossTenant-AuthSource: AM9PR09MB4977.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2022 04:50:47.8989 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR09MB2625 Received-SPF: pass client-ip=40.92.69.41; envelope-from=arthur.miller@live.com; helo=EUR02-VE1-obe.outbound.protection.outlook.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_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1656219108; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=4C3BYoO5XBEdhu9gBtClq26WzoyQVHPGolKZfOs6pCk=; b=oI+LrEObeg4o+Px+NuDoiqWwEJqLB0zpbbGdrt+d2ufQXLP2a090s0ckGOTvhuOMTRm0Or G8LfMFwEaklVDK+YJlcsD2hL3mdW/SWgjhUfhqmdLvYoJJCLyLbag/GRctDJ95ju9gIyRK URRvl/ZemhDpyx3hoK1DPP4Rk84XIcY+CWmJEAt6EZbcCdloh6em7KXLa1uYqo27GN/A67 cpFrfZaF70fIs4+b35QvTmfAk8GmN1C34+vWSY95VROKxvjksVJvLKc2gzcWkG9dvUC3Eb 8fWXcQWQaJRK/uQUazVLuhOVSyevklv0YTCfsCwA93of1itrCWkatWb9s+BpdQ== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1656219108; a=rsa-sha256; cv=pass; b=mW0v2JEY/C4deylsg/RCpph/cSn4ADLFO3wOFeKiIVzS1hI1AuLF1Y4SK931ghQlG8De0T rxznIM1IRhl7VoOYJEL3uCsmIW++R29BvxjilMw7dlMyp7ptXyqNsYftvvWDTnOkbhwrP3 I4O9AxrpNu/kl8yFi3RCHHNputLgsSdEDhDiRabWWcmazGlsl8hfSB7p3qoDnMlxS6tb9A hxpcOu8IwHn7tLvC3/fLI7p6YA9OLLEs2fSx6whZPv8E0PDK2AcflsUop0YWt062eRPI6p TxQa5Pg3/JysJMdgihZ8uTwE6akqfcBjreUqWpLKXl5s9gEfE+ZHsUzbHaE4hw== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=live.com header.s=selector1 header.b=Sx3WI6Df; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=live.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -5.26 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=live.com header.s=selector1 header.b=Sx3WI6Df; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=live.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 8638A2CEA4 X-Spam-Score: -5.26 X-Migadu-Scanner: scn0.migadu.com X-TUID: sFkREZUh2pCN Max Nikulin writes: > On 22/06/2022 19:13, Arthur Miller wrote: >> Max Nikulin writes: >> Menu should and application should be separated in my eyes. Menu is just a >> graphical/audio? presentation of selectable choice to the user. As such it >> should display choices, let user pick a choice, and return to the application >> the picked choice. Compare to completing-read, or org-mks. I don't think we >> should mingle application states and menu states. > > By state I mean some structure opaque to menu package. It just receives it from > caller as an optional argument and (when given) later passes it to > handler. Maybe it is alien approach in LISP, but in C (where closures are > impossible) it is a widely used technique. Functions having callback argument > usually have another void* one that is later passed as an argument of the > callback function in addition to other data. I understand, I have done my share of C, and know what you mean. Say posix thread will take a void* to user data, and pass it on. This is exactly what this is about. It is just that we don't need an extra structure to pass around. We have a menu entry, which *is* the user data. Well at least most of it :). This structure looks like: (key label user-data) Where user-data is any elements in the list user wishes to pass on. I don't even require the list to be a well-formed property list, I thought it is left to the user. key = shortcut used to create mode-map and label is the string displayed in the buffer. Later this string could be used for compleating read/isearch or whatever, if it is desired to provide such interface. But really those two elements are the required ones and in the first place in the template. The rest is up to client code. Compare to org-capture-templates as illustration. We don need to keep it compatible with org-capture, so it has to recognize two-elements form: (key label) which has special meaning, and that translates to all other clients. I could transform those, but I don't think it is worth work. I will also see if I can rework it to use another two element form: (:separator separator-string). I disslike the tripple nesting of lists: a menu is a list of tables which are each list of lists. I used this approach to implicitly tell where separators are to be drawn, but after second thought, I think it will be prettier and more intuitive for client code to explicitly note where separator is. Maybe I could even mix vertical and horizontal separators in same menu. I'll see if I have time and interest to implement that one :). > (org-buffer-menu > '(("a" "Option A" (1)) > ("b" "Option B" (2))) > :handler > (lambda (entry state) > (message "value %S state %S" (nth 2 entry) state)) > :state > '(1 2 3)) > > Menu caller does not care whether some buffer is created to present menu. Menu > has no idea what state may contain, it just passes it to the handler. When menu > is implemented as a buffer with keymap then state is stored as a buffer-local > variable. Exactly, and this is exactly what happens when you pass in a handler. The handler gets the entry, which can contain whatever client data is. Again, compare to org-capture-template. One can mentally see a menu entry as two lists: (key label) and (user-data1 ... user-dataN). They are just lumped into one list (key label user-data1 ... user-dataN). There is no point of separating this into two lists, since we need backward compatibility with org-capture-templates. > As to your current implementation of org-select, I do not like that it is > responsibility of caller to create different buffer names to enable multiple > instances of menu. I would prefer to control single/multiple instances through a > boolean argument of org-select. How can we know what client application would be called? In which way can we guess we are called from org-capture or org-agenda org some user-app? Or I don't udnerstand what you mean here? Reason I removed :transient as the flag to say the menu should dissapear after the choice is made, is that it puts control into two places and messes up the code. Since a hanlder can do anything anyway, it has to be checked in both places. So I removed the transient flag, and lets just the handler do it. In that case we know where the buffer handling happens. I think it eases up usage and implementation. If you have some cleaner approach sure, it is appreaciated. > Arthur, I see that I should response to more your comments. However I am unable > to identify source of disagreement, likely it is some different I didn't know we are in disagreement :-). > likely it is some different > assumptions. Could be. Could be that we think about same thing, but we see it a bit differently. People solve things differently, so would probably have different solutions if we worked separately on this. I think it is normal. > assumptions. That is why I decided to concentrate on a couple of questions in > this message. It is ok. I hope I made it more clear how I am thinking about this. best regards /a