From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.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 sBZWOK9K52OffQEAbAwnHQ (envelope-from ) for ; Sat, 11 Feb 2023 08:58:40 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id YOFtN69K52PmvAAAG6o9tA (envelope-from ) for ; Sat, 11 Feb 2023 08:58:39 +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 7F6D5CA99 for ; Sat, 11 Feb 2023 08:58:39 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pQkls-0007U1-TB; Sat, 11 Feb 2023 02:58:08 -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 1pQklr-0007Tt-Ib for emacs-orgmode@gnu.org; Sat, 11 Feb 2023 02:58:07 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pQklq-0005Wj-1e for emacs-orgmode@gnu.org; Sat, 11 Feb 2023 02:58:07 -0500 Received: by mail-wr1-x429.google.com with SMTP id o18so7358613wrj.3 for ; Fri, 10 Feb 2023 23:58:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:date:references:in-reply-to:subject:cc:to:from :message-id:from:to:cc:subject:date:message-id:reply-to; bh=sK0RG/7YDNWMH4xXzC+Mkj/U3rc0wGk/YUj+PBx1r4g=; b=agbqIYRt8ajl8MVTb0q2YnJujWWUS8ZZt72pwI+JCVdCIkJSbwZua3JhlbVz5oTfUn CjJi9KTGpAwoT+PjET/SFJcRv5TFA3TalMnKNpLdr+3zYaxENgArwlRFtgEm6QZTNgDM 0DBphQBUNxmcWsQNXTZcYwtEBHxq94Xu6kZd0MNzrltj6UvLZsIB2K8DTn4/G1twsI0/ 5Oa3UeLKeRBt/5cCeKQflyTU1YaTC+xvEq3dROk8SHtbYHjtsLPO6hSltzhDL6e6buL/ Ojjmf4gez+tDywwL8t8S0QBMf6wZM1WTPEtVvwTKcxxWP8OA6V+IwEzfxTzwmwEdxEoJ lj2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:date:references:in-reply-to:subject:cc:to:from :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sK0RG/7YDNWMH4xXzC+Mkj/U3rc0wGk/YUj+PBx1r4g=; b=XU6MtoR9VoIeHgmgcrFr8zXhSO5zfjO8rTr9b3/JZbSjWBmwwM074m3eTgk5dt+OIH J9oQGvYOJAztHOaH+HEoBjtVxv2HSAR7RXmR3xpenEECRhjSr7pla4a+9S11rbcpIOe5 hzZ3FGA3bwWEZTX/LT+0Gg24Hww5DV0HjJkqIBNchB/CGNbSyYrzDnwmvtyh7DXlJKkj Q+MGCLN2Ruo4QLCPN4P3tHXuYjP3XaV9WSaqreW/zK1QsMs0lCRK+sd0sljL/eNlTXsK dE/P0sbQ28ppAOYtTBBHjIeGS8mJxw0SSWpMy4BxKTUKy5MHTkYDg6FdVYp9B/c7/R4E +WVw== X-Gm-Message-State: AO0yUKWVrfDevmsltF4BvtaWhp/48ueCEwAFgf/dOGTYCJ/SXbaGABLa TlKfXYbRj28tiPUbSu4X2pY= X-Google-Smtp-Source: AK7set9RF7qrTaeXmPtvRXvQVsGTOdZj4VsOCTTDL+1GNU/K3Z34BYzhDH8gn9J57pkhhkBFoIOsyQ== X-Received: by 2002:adf:ee0b:0:b0:2c3:ea95:3986 with SMTP id y11-20020adfee0b000000b002c3ea953986mr16109669wrn.34.1676102284147; Fri, 10 Feb 2023 23:58:04 -0800 (PST) Received: from keynux ([2a01:e0a:505:3460:169:7511:f49a:58eb]) by smtp.gmail.com with ESMTPSA id i14-20020adff30e000000b00241fab5a296sm5501859wro.40.2023.02.10.23.58.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Feb 2023 23:58:03 -0800 (PST) Message-ID: <63e74a8b.df0a0220.7f45d.5b05@mx.google.com> Received: by keynux (sSMTP sendmail emulation); Sat, 11 Feb 2023 08:58:01 +0100 From: Bruno Barbier To: Arthur Miller Cc: emacs-orgmode@gnu.org Subject: Re: Problem with let/cl-letf binding stuff with org-capture In-Reply-To: References: <63e69450.050a0220.9052f.652e@mx.google.com> Date: Sat, 11 Feb 2023 08:58:01 +0100 MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=brubar.cs@gmail.com; helo=mail-wr1-x429.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, MSGID_FROM_MTA_HEADER=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+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=agbqIYRt; 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"; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1676102319; a=rsa-sha256; cv=none; b=m5AOXvUV/VpiMDzBpIZ8svt786O2rUoS/TEV7M+aVifuah0CgMnvvPAo65iKSevYOXswrk 1c9t5Knczzcp/qGN0VO1AET/3GPzq+jnkxpnM3F7SKvhGmKeE9gQcWwwzTEBy3+Io8e7FS vNkmixOmlr7YpQbrlz+A7vhz2cMM2MuIBE5xifoJHpVp1oeK8/+kHkiRHnQ5/cbGY81QZo eTx7JL1c0yOFQGQRW6iNn9Py6Jh3Ic8dR5ql3nwu8ZL2zx0+TrM2oJYW2JxpGzJzdmRIlc E4m3qLMpyF85I7QciUlQu2n+N7Nm/5VAITrH+D07B/AEyZAb1hfeMWl+DrDdbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1676102319; 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=sK0RG/7YDNWMH4xXzC+Mkj/U3rc0wGk/YUj+PBx1r4g=; b=jpfRb4bwHUov6txgNv+HkC8G6Y3n2IKcbzPrRH5fEyjspCGCBEcAMA/U8JAhy9mK11NXzQ TT/uVNJgf1DNs9RAUeh1H3JVJTLb3gfXu57c6otuBcu8MYjqTWoxafJI5vjjJT6dZXc4d8 vD3XOsryZVCButEmoMzWicq6WvU+NEM2ToJaiIm491BLwZ5uBkor8vAruwNYXtrkUdVtLZ 4y36e1pu1UNLzkXrEOpq64ZdXaaq40pSakFSXgfJ7sowQpLdQG/OVqTNQC7dMQkL66DDjj bgJMcWQJHtoCbGP+kSOGNDlwds358WsbMM9FA8f+HF9TKeAQBdibY1PSDsE+Zw== Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=agbqIYRt; 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"; dmarc=pass (policy=none) header.from=gmail.com X-Migadu-Spam-Score: -11.30 X-Spam-Score: -11.30 X-Migadu-Queue-Id: 7F6D5CA99 X-Migadu-Scanner: scn0.migadu.com X-TUID: 4uB3yg7VGklr Arthur Miller writes: >> Bruno Barbier writes: >> 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. The hook `org-capture-mode-hook' will be run in your special capture buffer. You can override the "C-c C-c" binding only there. > > 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. Even if I could let bind the function at the right time, I would avoid that solution, as I can't garantuee that this global hack will not break other parts of Emacs (other captures, output filters, threads, timers, etc.). > > Anyway, thanks, I needed the reminder above. You're welcome. Bruno