From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id WP4KOuk252PYMwAAbAwnHQ (envelope-from ) for ; Sat, 11 Feb 2023 07:34:18 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 8CUjOuk252NJLwAAauVa8A (envelope-from ) for ; Sat, 11 Feb 2023 07:34:17 +0100 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 60698AD71 for ; Sat, 11 Feb 2023 07:34:17 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pQjS8-0003T7-IQ; Sat, 11 Feb 2023 01:33:41 -0500 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 1pQjS4-0003Qe-4g for emacs-orgmode@gnu.org; Sat, 11 Feb 2023 01:33:36 -0500 Received: from mail-db3eur04olkn2083.outbound.protection.outlook.com ([40.92.74.83] helo=EUR04-DB3-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 1pQjS1-0008Dt-9l for emacs-orgmode@gnu.org; Sat, 11 Feb 2023 01:33:35 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lCTOQRic4Z4X4qsVBT5z9xKKVXNUPo2LCNsonThEdcwO7jo55B6A5762W5MDW8g/i8dVgigDX0Gs+hQMk+5eFAS5pPLPEz0urwG1sCjNzo8L27Dpsw/NpPtg+A0KB1NuM2NDK/xpiapSgNXlGd/KGCPgUHe77P99dxavaVGDhVVlDzgB6aVmxnqEewrsmI+4q3bUOk7E+VsHAHhvIV9Ho8Ky519CIzDLysSEn7+UgLksfvMaDDkh+ZgTYOwbB8Opsyja1WB8n+Z1ndGCYo7mLy6DrzMmbaWVMvAFqmIRwANG0pIgZVdIRPcHUuPzI3pFe4KRQJZxbzBEHIWMAlKDYw== 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=3PdBrBgf7vs1I7zae8dB7k12Q8Au9p6a7FfNLtLIOZ0=; b=gcUG8amM8zaWBA9sSD3vTEfIody4oXDycJU+7KN6JlcYtPitibt0kMrSoCeUmqv3dMgA83pauGXmhRCZiF8/eSIjxJ1Ox7rWowq+LE7/jq7+sPTmdusK05FEWQ7ldmx+uh9FRPTv8syPfQbiYKsV/+gDaZOao7X9i3DJX/9y7j33Y6rYo0x+mfsWLRymta3GYSAjQ37/6+CVyWeHzI2iUSi22VlVTuxFiooZ5m8LKm0BQlxw/yrvoLxsoPzj0wCXYy3i5s9aNVEf44U1Ruf5ZSu4AvAGXtsvo9e9v0kirj4Ee3fJHXTpN/x9/wdj6e06fqD0TWudnhlKovkZIaWRTw== 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=3PdBrBgf7vs1I7zae8dB7k12Q8Au9p6a7FfNLtLIOZ0=; b=UXzuJzMi+extYL+a0tq2VI3x91bYonN7rMp500zFE+GmlxhDaeQTaxHsehi5bXuYBdkD9UbOJ/DhxWVl0G8j7xDKiuoN1UGeTnRi7kg08LKqO5JRDZ72jmOj5oHnZ3B7bB8esV6dWWUgTYzkdkhG4GCrORfjmbY6cbNj0T+ivgo77Vgl9YZb7gea3aulkj1RpFPiHTrC/KTHeiKPzPb75Q9q2gvmDS4D9zAk/1glo8fReW2e3sNnr81hxFhhwon0a3mf2ec0qX1MHLQ/Pgj3PJ2c2so1WidPP/d+wNH/kiJxVs74EtYfz5gcZxIFsK0i1HTprELTALpwThuNsTHg6g== Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) by DB4PR09MB5773.eurprd09.prod.outlook.com (2603:10a6:10:380::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.18; Sat, 11 Feb 2023 06:33:29 +0000 Received: from AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::f2af:9752:58df:ad9]) by AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::f2af:9752:58df:ad9%7]) with mapi id 15.20.6086.022; Sat, 11 Feb 2023 06:33:29 +0000 From: Arthur Miller To: Bruno Barbier Cc: emacs-orgmode@gnu.org Subject: Re: Problem with let/cl-letf binding stuff with org-capture In-Reply-To: <63e69450.050a0220.9052f.652e@mx.google.com> (Bruno Barbier's message of "Fri, 10 Feb 2023 20:00:30 +0100") References: <63e69450.050a0220.9052f.652e@mx.google.com> Date: Sat, 11 Feb 2023 07:33:26 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Content-Type: text/plain X-TMN: [ONOKrNTHPm4zlGr2laLd6YYKlj1hzia1] X-ClientProxiedBy: FR3P281CA0176.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a0::11) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87bkm0zp6x.fsf@live.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR09MB4977:EE_|DB4PR09MB5773:EE_ X-MS-Office365-Filtering-Correlation-Id: d2e01b64-5a03-4dad-7b55-08db0bf9e2b9 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8V56reDpeEO3OkasJuQBuuTuzVCK7wOOiM8PCrOAeeFSSd5BC591JJsClC0AC4u66J8oo65qElIm8su3G5SyOnh2R8DO9S8O58ObTuOH2ziImeL21R+v9HSBiRlZN2yb8BrrGICU15MkNOGWaaA8NfcvLqn8G86vP6RRjGo53TwWhZnZm7jJGJPh+lubXhMRfDE5zxzVu4a3B1XmDdb0oJzjMxNiBnVFzI2I3rRVAv7eiRWGLdi2poNscH1BnRRon/TnIK+iZHkpW7YFY24tPVVdaa/iL1eHosArha1mEjZUa1jmDLJGXhyFO58U5fuDu6IIyKqvTSw8VE25eWrscDq4IMYHCzaMFC+bKZTp+arRI4yMR8p6g0pLxSi7vimVkeynrpymDhw02jQfoUmP7HCU5DbRmvQERNLdaxX8fYIrGHkuKymKqitYJoh6cSmOtFWjeu42KrXDPwibFd1+Vh7tGJgb5jeQNYZkPvYggOk7gpEU3YNECG7YDi2ZCaVg+8ozKqNrkCfuGeqQmxw7peM0ipXOrzOEiIszbUl6VGpu2NyzP9uJfEA0fMvWi82+WO0YQlqlYFyCiUinS0uG1WKZ96G32J0S2//D4tCGawPG2ScStUu5gagj+cDdKNEVPVWXNpvvtMJoxTJK2DW2rw== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?GaQsjyyG8MJexGsSDGAOBKkhRcQ2yUzJ5/k82ZoE+9p5TNQyrjV8NFi4bPEn?= =?us-ascii?Q?ghAwtkskomMnaJNO1BJaQ12Vq3rB51z2AoaC6lrZxe1Vmad/TrckD6/i0E9+?= =?us-ascii?Q?hOP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god2?= =?us-ascii?Q?w0lzuAh/OjuwxstXe9iGfSuno3ICfjXKkFawDdgvyDbA8Coq0BtKYx56Yc/J?= =?us-ascii?Q?A9SI0z22R6tuTEEjf001K+Sm9aZZA1of/vQNVRGMCllv+IXBAXlCeO9jXBLX?= =?us-ascii?Q?XqGZ7uTVwRB4nSnvdcQEASo+NjvF485aCldusrV+DELVaBMBMUlZ7Hjcof8u?= =?us-ascii?Q?pk11Iin+w9q41Fpz8rm0zDmfBoRKaIuFmmwuK/z/zcAgLHpCKWAr0umkxG4b?= =?us-ascii?Q?qUZ6CxGwyo5k8ElMoaECOa+Y3sMySpxIxP0LUUHGkg=3D=3D?= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-64da6.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: d2e01b64-5a03-4dad-7b55-08db0bf9e2b9 X-MS-Exchange-CrossTenant-AuthSource: AM9PR09MB4977.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2023 06:33:29.5697 (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: DB4PR09MB5773 Received-SPF: pass client-ip=40.92.74.83; envelope-from=arthur.miller@live.com; helo=EUR04-DB3-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, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=2; s=key1; d=yhetil.org; t=1676097257; a=rsa-sha256; cv=pass; b=L72Q8Q3qDWza6ge6Uo8cBrbK5V+k1ZMAki4N3iBomoUzRPm9y/hihREn9vg/rtB5u/C/3l C37W4Dli5KzqULZ73W3WSlbUoBHlQ7scaHUAkO+eBK8Wl15lT5N9JnuwyyN6wb8ChMDDU1 mAlZ5sdDuhTFLfvtqsB17L0EaBcSYPX+q9hEl9u7eS0zNVJ+3qneUZJjvg7R7G2sm6Oe4G C7jyX/n5H/A9OQzfvCDl6E6elA9jACto7tty+kCbqhyEPF6h++zR71D1NWDJLElx42MgNf ia12+xr7Sowheh3gM5tr08/1FL5FSZY97i4GbvSUZ0ozvTHAPceosO0sov7bUg== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=live.com header.s=selector1 header.b=UXzuJzMi; 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"; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1676097257; 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=3PdBrBgf7vs1I7zae8dB7k12Q8Au9p6a7FfNLtLIOZ0=; b=fEaf7I6m4cJNcnD7pYRCBnK4EBTyD/6V9mEVHQ/nILHYzE050H6ncXkdCmIkMuanzGRkIo HCTbE4JcHO6cQdshrY70pg/NVdJLJENwpJbleFA+pAXi+dR8IF2C4IUvdHFhQwSQiF9yEz rDdCOM5RUqOjk+b5v+FJ51L15OJFVEnWEwkVD8sDrsXFab1GxnvNSVofUWDpCRPuhssskG pEvZw99bFixs++Qdj0L/46XU9CgiIQiUAR30FzQhYsvBFFCTwXe+zf8JBJMpf2HNMqYMBx u7PPZcD4m9UdoxLihdHEkD7kzRmdsKaB0IbMcypYMBvLFaVHNL8xAofMV10pJQ== Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=live.com header.s=selector1 header.b=UXzuJzMi; 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"; arc=pass ("microsoft.com:s=arcselector9901:i=1") X-Migadu-Spam-Score: -8.11 X-Spam-Score: -8.11 X-Migadu-Queue-Id: 60698AD71 X-Migadu-Scanner: scn1.migadu.com X-TUID: 5zYAuxaaPFic Bruno Barbier writes: > Arthur Miller writes: > >> However I see that the binding for the org-capture-finalizer, in capture buffer, >> is still the default 'org-capture--default-finalize' and not my lambda. >> >> I am really not an expert on emacs lisp; and I do understand that this is >> somewhat "creative" use of org-capture (to put it nicely :-)), but I would like >> to understand what is going on here. >> >> I don't understand why let-binding here does not work? > > Your bindings probably work. But, as the function `org-capture' > just *starts* the capture process, they are removed when exiting the > 'let', before you even begin editing your capture. Yes of course :) I am quite aware that org-capture just setups the buffer, and that org-capture-finalize finnishes by writing stuff to files etc, and yet I have tottally forgott it when writing this. This for opening my eyes. > I'm not sure I understand your use case: if you have a piece > of org text, you can put it anywhere (possibly using refiling). it is just a fun test. I wouldn't do that myself normally and I have no idea why the blog author needs it either. If I wanted to input multiline text into some dokument I would open dokument itself. But this was just a thought I am testing; you can read in the link I posted in the first mail. > If you really want to just get the piece of text, you might be able to > use the hook `org-capture-mode-hook' to replace the key binding to > 'C-c C-c' in the capture buffer, so that it calls your own function that > will take the string and call `org-capture-kill'. In this case you wouldn't like to replace the key binding, it would affect all org-capture buffers; the point is just to replace it when called in certain context (my-read-line). Let-binding the function in this context achieves exactly the same effect of C-c C-c beng bound to my function but without affecting all org-capture-buffers. > You can usually use hooks (like `org-capture-mode-hook'): > (info "(elisp) Hooks") > > or, if it's not possible, you can advise the functions: > > (info "(elisp) Advising Functions") Yes, I am aware of both hooks and advising; but again, with those I would affect all uses of the function, and that would lead to checking some global state or variable to switch on, which is not optimal either. With let-binding we can have different behaviour only in a certain context. Anyway, thanks, I needed the reminder above. cheers /arthur