From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 2C4ILQjZ7GPzXAAAbAwnHQ (envelope-from ) for ; Wed, 15 Feb 2023 14:07:20 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id SCgTLAjZ7GNyPgEAG6o9tA (envelope-from ) for ; Wed, 15 Feb 2023 14:07:20 +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 3C55A2334D for ; Wed, 15 Feb 2023 14:07:20 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=live.com header.s=selector1 header.b="mzF7HOH/"; 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" ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1676466440; 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=tIyFHiGrCzxnOrw6jgYeZgdz6GCybI8TFd3lFWlWZRY=; b=RGJxdBKW79YSnrJwDIvltDVtTg0Ksby5CbUkjBaFSgiUyvckHFDImXClb/xiON/6GQJJDr G++M2xI4IPWt00+aI0ElVaM3hP7WrbkTd47k/RdK2KDFAepWjaGKjMUH8Jac67FXz3NvdL fdvUIjXmbaDNVO6pleXD4F2V3sF9l0YZNElHa5+lyH3cntpFmthvHwKSVqNC+hhUSqdQhE 9iT+fUFgnMGy7WDQeT9VWTCOvrLf8OPisvTlyyipkwFGdQn9tazkv/OEskDUFdqArFjhI5 DDxKIoyER5WZSUPM39NLwKIhin6YfRe687Hp/JtP5SgSoOYwJjB0TEdj6pPC5A== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=live.com header.s=selector1 header.b="mzF7HOH/"; 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" ARC-Seal: i=2; s=key1; d=yhetil.org; t=1676466440; a=rsa-sha256; cv=pass; b=M4RAjsaP9fWy4PDftkzbWpBrMyoBzBaRpgUhvhm1IKN37aOqk2VxhaPRAPQhoCUszHbCxo 0wIc8MX0KWOsXwp+CFTqlqf8JSyWcxkJy2QjR53l1I81O9IqLVIRBEXbPE7DF+MPtvkzLc 5HX5dokREyxs9Y5NA8T8JSQrMMADAhx//AsVRSraT+0ISKCbeU+Mjb+qJpNbgYHqNeRYl8 wUbBLcLaLc5JSQDY2uCq3/KzD1K6fI0skQz67onGeZdQDQ6nMXh3y9PvhUL5JKKw1h95rd 4XcgcEUhBdJeYHbRDXPWQgzYE6yqsMFGVxLvs9h2aXBLJF4cNNuuLH90SGSW4g== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSHUM-000712-H7; Wed, 15 Feb 2023 08:06:22 -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 1pSHUK-00070k-08 for emacs-orgmode@gnu.org; Wed, 15 Feb 2023 08:06:20 -0500 Received: from mail-db3eur04olkn2028.outbound.protection.outlook.com ([40.92.74.28] 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 1pSHUG-000584-RJ for emacs-orgmode@gnu.org; Wed, 15 Feb 2023 08:06:19 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LjmJrYB9rBopmWvVofQMOu83mNwcs9s3R5g+AJ8C6Omur2+xNRoywq+hAJcnQQ3v54VKNgxwBHZd0W+sleukT2m6x/sH2x3KVZmV8socnL5uZmfnKpyk8vEbdukFWCTeMV6ETqswXW77VbWjGfw6I7R1u8InL8TCjXlEhMV4iBnnN6RYHg7XNah006ElyvKBgmmu3erSCm69sScKWStqQorTy8LHXu4sYs0VMP6omgz+c+Nb75sy80toz5Q3NBblujmrLJDA3uovq0OrDvpj7m8j1H1M7XQ/P9p8ZBvjlxcOTsDVaDGBl9TFuBRca3MxOxaRnIKD+5uO2zdjREz5qw== 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=tIyFHiGrCzxnOrw6jgYeZgdz6GCybI8TFd3lFWlWZRY=; b=GIA3HgiJLb6yf6fSPatqRP1eS+OiEpaocNDEaDSMlvl150RLDo/2smPgwIQrzD/xyIjqMH7bbqNstM8gdqfDZ6lmbzLEeslmy+MnMHJBI/+geeu4F+IMaOEdtpWirOaUPy7kQZOrTK7EmYu0XQWL0u6QrH714r8XOliLZNPuOG7IeNrMZRBhWoPxiIenKBqmo12S+gyvXr0RHIkboVPuVInqXMxAkqvacSmFGRgdS5mLtmLj/7WkhDL7j58yk5I+JVaELQrD9JAxun4NB1D9MiYsESaxP4M7qkYJLJ7/hWS/uUe26RlYMRhhoRhqD9r3eMz3AOxEra2Xpp/af03VwA== 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=tIyFHiGrCzxnOrw6jgYeZgdz6GCybI8TFd3lFWlWZRY=; b=mzF7HOH/xQ/CvwZtc6q/lr2CNR+nD/byxzt77BlbN6D48CHMzE04AyZTDi75iyDzRm9qJO6NJB0sXqJ8tzwzmquQ1zLX6Ej6H+Jq+3hdBGX7YYbqgPHLIjp3WtKkRbCexe60OYgaSYsweva770U66Md+d11LrvTIxhRoHwar4CA2xWAdxFdTcJgh5ZiBx7zndiIY4IZByfOkfAnTooTnraOolyrja376SPFrqe+/mdEkrg3UNKAWFf5e5IE/sBFyskcltm4IpRuyKvfFwTK+TCzCe8iG2Qfsii9pOPX5w5c6l0Sne+CLavGI+/fbURoMabT/k0GwSSG8GoFzI7DwkA== Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) by VI1PR09MB3919.eurprd09.prod.outlook.com (2603:10a6:800:128::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Wed, 15 Feb 2023 13:06:14 +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.026; Wed, 15 Feb 2023 13:06:14 +0000 From: Arthur Miller To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Subject: Re: Problem with let/cl-letf binding stuff with org-capture In-Reply-To: <87fsbcuoy5.fsf@localhost> (Ihor Radchenko's message of "Sat, 11 Feb 2023 16:49:54 +0000") References: <87fsbcuoy5.fsf@localhost> Date: Wed, 15 Feb 2023 14:06:12 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Content-Type: text/plain X-TMN: [HRZW3QAjhGM2b4xxoPwiwzVxQ2oYUWv/] X-ClientProxiedBy: MM0P280CA0100.SWEP280.PROD.OUTLOOK.COM (2603:10a6:190:9::18) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87cz6bw01n.fsf@live.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR09MB4977:EE_|VI1PR09MB3919:EE_ X-MS-Office365-Filtering-Correlation-Id: 807e52a0-0e01-4b95-94d0-08db0f556a38 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QP4xcxDYy2RMQk3Vmmlr6fTczr6IkBWhJguWc2j3Jfq8LizJJOwbVeiry0BLy3BJiFJodMl27caEq0T5pg3PZ5Z63wuUaTuTvPZot3XA7FvH+mJfIpckqxn7tsZPp0Nc8xbtfJQqFz/ZvIP7NILvljzOuqRvqj5V0DEFwYfkmqv/k7clG+ptAXTWtN0VDemqfzN5uCoTnQWRpOY3VRyAhYDi9lpGcN3e6f/UdboHRjTruD1euBJFLYv2YocETBwQMEE0ubLmokfg6jQiQ2Zw2bxXaNZNMpxRhsAIjARz//ebwd7N/HqdEqyBSo8TYEHz2DeaYWNs88gkoIAE7qN2bAvhHyPlqyJo9kBeVKiOFLnvBWbPImwEMoZofeO0vTA1cJPD7C1pk/K74ftFcun3ltIey8EoaNH9A6GKVIsrtBmJ97PBtHCxN7lHQFKrAsk2yL2ibMM4HuLCwvRbIH7F7YtV3t1DosnN0jfKqo78twtGXinRKqZ4EG3wmYGEZiO3dnvm72X2YX7vfgEphhR61OBIcCxqOg3uw03f+cxq2x8xAJJHxhuiH7W76iV+9XiHrTADc6rXkJNZwOTwrM87rjj05gM0K9Gt45UwC1rLgu3K9cE6fslONSGdG60CTKoY9AXGPQrWU7TXwok+SCl8cA== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?nqTw92PI78wCCIIUs/vpF160QaWsiLWJAoLxmFg7An63p7lIZaFc1LYPkcuL?= =?us-ascii?Q?7R/96p9gJUMgjAlhkwJsfQ+3v+C6eK/s3qJOkNBpAm4Sj5iWn1JnQfoBaNgy?= =?us-ascii?Q?sYW/e8LrfqXsHifmAd5y3k71TpBCz9I6I3dbWyyZZ63JIXlDV7TooruTYPY3?= =?us-ascii?Q?GKR3PJY1H2/02aOkL215hu2N6TAOYeqYn5ARPgjMLtvfqjEC6EBAaJyVme64?= =?us-ascii?Q?g2IN4D8D8ZcKh7R7dENHgd9MpJE6qIeui5jLscsm/IECW32D9Ee3mSiOnQWD?= =?us-ascii?Q?fQyB5pXp26o+SUObxK6dSc/wjZQc9yb2FDXmSD6H23Ff7yrLzfGutSNuo2HT?= =?us-ascii?Q?Dvtw+Q/xyqIkUw09SeodoV073dbZ5nEFZdVB8XvIaQUPyZUERHud7OrLElMF?= =?us-ascii?Q?T9bIZ/Xq0Ar1aZDR03Zo2GV480QWwVae/Miy7rUSZr7y1S6nBQwWmwVUu6Su?= =?us-ascii?Q?81z/E9/9hyTRjiNHJx2zoFkBos5i0D9RaCjvdkD2rrrf7YbQ5uKs5q0b6afR?= =?us-ascii?Q?kEG3ozkV56YpHL+hVq/EWjmD9NrerNTOdMFsDipNM3dl2dnAlJq+jQ71uB9j?= =?us-ascii?Q?Mu8tI0aXaNL8ggpOCYXUAvFovcJu7lRs0wCcaksjpuB+RGiMkm1+bv/Q4PDJ?= =?us-ascii?Q?pMu3/NEd6ye30dSTiMKltnwPrTTDXpyBrr4Yctf4S0Mlkcqz64yJNc2C0NMG?= =?us-ascii?Q?GmFqTOz8I1an2TF49Qv59cgs1K4BNGFvy9R2sV4WAIX75UJcIDsJI0wz9aam?= =?us-ascii?Q?itaYE5yoG0cQlY4EKBk/h4tuV/L1Js3lZt8qX8E9XvUb361/ehV/cljEhhxV?= =?us-ascii?Q?cql2IqGqe0pQYpRL6D4a1+qdNx9aCnOplapNQOR8uyqlPzJ1gyt3A2mjXx43?= =?us-ascii?Q?3cNytL4KdR8sOc+nde7nPSe3mVA6CpndjOvz6v8dEoVxyElvw0tpCD+0eH68?= =?us-ascii?Q?beVnr/UTg3jczKUrqIPOOOGCLKqKYXjGhFOI2VMHT033n9ZGaLY1FsE8/lEU?= =?us-ascii?Q?1qH6EjgwTlh/3bXOcDfcfSUpdXz9JxcxMWEPlZjPJqhxydyc7qZtSJ4gVGxZ?= =?us-ascii?Q?vxTIoJ+aagtBatmWk2lG/f5l0nkqdh49j4jziKP5yZ8/bsckuWifVYm9yIyx?= =?us-ascii?Q?tWM+qWeJx9/K9NHPFTFbmVZ56ALbraPux22pVWQW5eHkMN1IpLFVzhBOVAnK?= =?us-ascii?Q?/UedXT8JeFgIS0UPoy/0h1UbR93mrCUYenkeKzZV1ROy5+LmeN+oszAeGyON?= =?us-ascii?Q?Fi1++HOMfyG+65BUSXv3ST6V2OhJ7Ff3FMlw6wRt9A=3D=3D?= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-64da6.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 807e52a0-0e01-4b95-94d0-08db0f556a38 X-MS-Exchange-CrossTenant-AuthSource: AM9PR09MB4977.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2023 13:06:14.1000 (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: VI1PR09MB3919 Received-SPF: pass client-ip=40.92.74.28; 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: X-Migadu-Queue-Id: 3C55A2334D X-Spam-Score: -12.88 X-Migadu-Spam-Score: -12.88 X-Migadu-Scanner: scn0.migadu.com 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 X-TUID: hl4PlI8NLnmK Ihor Radchenko writes: > Arthur Miller writes: > >> Based on a Reddit thread: >> >> https://www.reddit.com/r/emacs/comments/10xhvd8/a_little_readstring_utility_using_an_org_mode/j7xziao/?context=3 >> >> I did a small experiment to see if I can re-use org-capture, to just capture a >> string from a buffer, without actually writing to any file. > > You can use a template target set to function pointing to temporary > buffer. + org-capture-before-finalize-hook I did try something this: #+begin_src emacs-lisp (defun my-func () (with-current-buffer (get-buffer-create "my-capture-buffer"))) (defun my-hook () (with-current-buffer (try-completion "CAPTURE" (mapcar #'buffer-name (buffer-list))) (let ((content (buffer-string))) (kill-buffer) content))) (defun my-read-string () (let ((org-capture-templates `(("s" "string" plain (function my-func)))) (org-capture-before-finalize-hook #'my-hook)) (org-capture nil "s"))) #+end_src But that does not work well, because capture will put buffer it is called from as original buffer and write to that one. To prevent that I can call capture from a temporary buffer: #+begin_src emacs-lisp (defun my-read-string () (with-current-buffer (get-buffer-create "my-capture-buffer") (let ((org-capture-templates `(("s" "string" plain (function ignore)))) (org-capture-before-finalize-hook #'my-hook)) (org-capture nil "s")))) #+end_src but than capture complains about the buffer not being a file buffer, despite the before finalize hook. I could point it to some temp file like /tmp/my-capture, by manipulating capture plist myself, but it seems to be too expensive to create a temp file just for a hack to read a string form a buffer. There is probably some other way, but I give up here, especially since you point our read-string-from-buffer :) Anyway, thanks for the input and help. /a