From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
Received: from mp11.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 WN16CUYQ6WO87AAAbAwnHQ
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Sun, 12 Feb 2023 17:13:58 +0100
Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp11.migadu.com with LMTPS
	id AHtxCUYQ6WPsOwAA9RJhRA
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Sun, 12 Feb 2023 17:13:58 +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 9DDE5C374
	for <larch@yhetil.org>; Sun, 12 Feb 2023 17:13:57 +0100 (CET)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <emacs-orgmode-bounces@gnu.org>)
	id 1pREyX-00036B-NR; Sun, 12 Feb 2023 11:13:13 -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 <arthur.miller@live.com>)
 id 1pREyE-0002xA-Bl
 for emacs-orgmode@gnu.org; Sun, 12 Feb 2023 11:12:54 -0500
Received: from mail-db5eur02olkn2013.outbound.protection.outlook.com
 ([40.92.50.13] helo=EUR02-DB5-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 <arthur.miller@live.com>)
 id 1pREyC-0000qf-5H
 for emacs-orgmode@gnu.org; Sun, 12 Feb 2023 11:12:54 -0500
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=Hdo/By0pYXlHgRs5+4LAxiYImQ9bR/pKX8Sg2ERTFUpXXm5yn/J2lBUbXk2E3m6JXfMmdtaqGArou01TboAefoYPr1bEX60KOckEJRScYkN/9Sp8v8pjaODd55/Id2CsB/B5c9WbJaLrkktPYUViu565JCwIezO9xDzZ7rokAYyPXUvqIEEDdTW9VFCExXIO4HnLPwSZanNuWds0v7xiGW1HLOj4B0RZ8zfs0SWYGnbd2Ca8cqQaVAjsgVyBklzHbPCEIpAULyhFPKDQ1HcuG1+zF86hBGZusXrgr2Uxw1+ktujz4wPyPoNDLZCOIQRPeKbJ/JErHVsst02Lz2mtag==
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=Ngx8O/mgAHherZsVD6ledN+Rm2Jz+junG0Zn8nYWYoY=;
 b=HITT9R6lOpRy5/7lLaMHfMTi+sPpXGCMXTjyOjZPHjvVK/RCJPFFlSrYA/mbYHY0FcBarBTxjQGqtlR5iequpE74Oush5+3022aFQgOwnzxRlAc8Yh/YxUbCkhAAjdF348MfaFHMbICA77LY200iySYrfnwWtwBGDjyTYqt1aeDgWWUNCeCd13c/Hb+zIy3M4TiDrQ6bg98MBRUrrzs5kJylSYrh+VMjvI5byO8YZgTCs7c0Y6bzFvFmXE9EcQwl9UN6IGZVwGQrWgMwElSvC64vo7he5MXtWqx2M37ei4XPG50ljQthDOVdeJysWXKLZGtC/QqQtZx7QIODTNhclQ==
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=Ngx8O/mgAHherZsVD6ledN+Rm2Jz+junG0Zn8nYWYoY=;
 b=FzKJQiQOGAcYzIXQ4RmOd/YvhO0Uj7j2J+txivuudKYpBQsF/EjU7lctsfHzy9h9kvix02LhodUOX0TSHOo2hN2bAncykFsNtGZ2Z4Sp5L3HCLkL8XjDuFJjM8joAd9uU0eZQCVUBenazUhcFtcGV2h8OjOdZhWKXBypjna0cAQoybPBE+0GkdV2gZkjnqXtPUyQ6ZXwNPahCsL6h64LT1CyeQGZroSW0i7X9L0836hEr07OxIV+fR7yeOzRnsUnBRRBswwRQEGfuvUcBukg4RMBoI5ZA7UYZlsk0R/fhSoWzLAJwCLVfmcOKSbGs4382RbbXqJvouDXOCcWhpbX8g==
Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20)
 by VI1PR09MB3693.eurprd09.prod.outlook.com (2603:10a6:803:13e::21)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.23; Sun, 12 Feb
 2023 16:12:48 +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.023; Sun, 12 Feb 2023
 16:12:48 +0000
From: Arthur Miller <arthur.miller@live.com>
To: Bruno Barbier <brubar.cs@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Problem with let/cl-letf binding stuff with org-capture
In-Reply-To: <63e8afc4.5d0a0220.969b4.d166@mx.google.com> (Bruno Barbier's
 message of "Sun, 12 Feb 2023 10:22:10 +0100")
References: <AM9PR09MB4977E7E66F2E6BD0345DF46496DE9@AM9PR09MB4977.eurprd09.prod.outlook.com>
 <63e69450.050a0220.9052f.652e@mx.google.com>
 <AM9PR09MB4977E771D98F9997736E0B7F96DF9@AM9PR09MB4977.eurprd09.prod.outlook.com>
 <63e74a8b.df0a0220.7f45d.5b05@mx.google.com>
 <AM9PR09MB4977306B77F9A5338764324596DF9@AM9PR09MB4977.eurprd09.prod.outlook.com>
 <63e7eb19.050a0220.56539.6aa7@mx.google.com>
 <AM9PR09MB49778B9E1DAC014FAB17920796DC9@AM9PR09MB4977.eurprd09.prod.outlook.com>
 <63e8afc4.5d0a0220.969b4.d166@mx.google.com>
Date: Sun, 12 Feb 2023 17:12:46 +0100
Message-ID: <AM9PR09MB49773EB425B045F9D152EC5996DC9@AM9PR09MB4977.eurprd09.prod.outlook.com>
User-Agent: Gnus/5.13 (Gnus v5.13)
Content-Type: text/plain
X-TMN: [43ubiaYpheY63D58GBHOdD+ZKxI9TtXx]
X-ClientProxiedBy: MM0P280CA0043.SWEP280.PROD.OUTLOOK.COM
 (2603:10a6:190:b::14) To AM9PR09MB4977.eurprd09.prod.outlook.com
 (2603:10a6:20b:304::20)
X-Microsoft-Original-Message-ID: <878rh2dfr5.fsf@live.com>
MIME-Version: 1.0
X-MS-Exchange-MessageSentRepresentingType: 1
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: AM9PR09MB4977:EE_|VI1PR09MB3693:EE_
X-MS-Office365-Filtering-Correlation-Id: 97b4ee52-7233-4568-7b30-08db0d13fb75
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: oqor3iu6f491+dpTjBTDgxu6GEsyPEUR4/FNXbXW2n0zO9D5SMpBjwZOiZlEB39gz78bwjLffxRZf3yZC3GNXT4Jz2aACH753Frde4NszNoemnFlr822qWVMke53hlIIGZ4ERCYtyafyWMJkUhGk4+rwFMzfrS8o6Uxq3NxaGEk4Kl5aSla4cNt/Aff0DB1PQIhBIlI6kv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Q?hkn21bJtoSClQQxbBtUV2aN3i6geMtlTBpgs3NySMQ=3D=3D?=
X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-64da6.templateTenant
X-MS-Exchange-CrossTenant-Network-Message-Id: 97b4ee52-7233-4568-7b30-08db0d13fb75
X-MS-Exchange-CrossTenant-AuthSource: AM9PR09MB4977.eurprd09.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2023 16:12:48.2845 (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: VI1PR09MB3693
Received-SPF: pass client-ip=40.92.50.13; envelope-from=arthur.miller@live.com;
 helo=EUR02-DB5-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." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-orgmode>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=subscribe>
Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org
Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org
X-Migadu-Flow: FLOW_IN
X-Migadu-Country: US
ARC-Authentication-Results: i=2;
	aspmx1.migadu.com;
	dkim=pass header.d=live.com header.s=selector1 header.b=FzKJQiQO;
	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=live.com;
	arc=pass ("microsoft.com:s=arcselector9901:i=1")
ARC-Seal: i=2; s=key1; d=yhetil.org; t=1676218437; a=rsa-sha256; cv=pass;
	b=nuAMWYRuBQvieA09rm3kAkNQ/V0VCWolsR5Ga21Qn7SLwtWiG1fgNe/SM3NWJlGkYDpTt/
	5jZKvPvVLkda7dO+CZ3H4HbO5jMXob7DPADBwRJV4VKw302akpEkW9H1sMBGO1sghYFWLa
	nwl54kq8Kq1hw4/Ym0b3+B5LiazTFpmH1PzjeBfGc0XfO8Dat6kuWnST4Tp8UYr9VvInfY
	m0gAND/4TBjrqAw+aSjrUTheOnW/vY01CLXgAnZ7Lc3OoCGnW+6XtReO41ds9FvYOXQ0+g
	z853MQc59L220teQnt+4zQmXMxY2sZPVsJ8CApkzR03nmTO3nm+Bb6GhOKKFgg==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org;
	s=key1; t=1676218437;
	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=Ngx8O/mgAHherZsVD6ledN+Rm2Jz+junG0Zn8nYWYoY=;
	b=BcpNvTQYjepEzaQAPxMQdiDrFzn7hsgTp3+0xZVhUsQBvHsfkEX3Xmq9lpGqdNcyc2a/o2
	e3AWJAf6xSOuQaEEh7CG6yUkMeGpUq4t7YVDi/lkctW3CifidtdeWg2wWhqTWa8M8T8IKQ
	V1frh/sEh2mibog0MOBYT+avfeELaVWRQ7TyVs0LstNcxmFiY+BO6Y4L6/QVZPy6NQu3Od
	EweBvfW5uhDqH4urkTH2vNcpnYDejyNcmohHyBAETFlrvc60RLMvV1YSwuWC7n7MwoJG6C
	SiOKQLXsU0GHMZOBTbVSy/S3ATSTNtnNHnqFuyR1bOGoZEV8xRVnmr+WvWfmAQ==
X-Migadu-Scanner: scn1.migadu.com
X-Migadu-Spam-Score: -7.38
X-Spam-Score: -7.38
X-Migadu-Queue-Id: 9DDE5C374
Authentication-Results: aspmx1.migadu.com;
	dkim=pass header.d=live.com header.s=selector1 header.b=FzKJQiQO;
	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=live.com;
	arc=pass ("microsoft.com:s=arcselector9901:i=1")
X-TUID: qkiBtVnLTHq6

Bruno Barbier <brubar.cs@gmail.com> writes:

> Hi Arthur,
>
> Arthur Miller <arthur.miller@live.com> writes:
>
>> Bruno Barbier <brubar.cs@gmail.com> writes:
>>
>> ...  but I feel a
>> bit of passive aggressivity here, for no good reason tbh.
>
> I'm just trying to help, giving some valid or invalid advices.  I'm
> sorry that what I wrote, and how I wrote it, made you feel that way.

It is ok, I just don't want us to go into social media discussion style where
there is more important to assert own ego then to come into some insight.

>>>
>>> Yes, let binding is fundamental. But I think it's the first time I see
>>> 'cl-letf' with the 'symbol-function' place.
>>
>> https://nullprogram.com/blog/2017/10/27/
>> https://endlessparentheses.com/understanding-letf-and-how-it-replaces-flet.html
>> https://stackoverflow.com/questions/39550578/in-emacs-what-is-the-difference-between-cl-flet-and-cl-letf
>>
>
> Thanks for these links. I like cl-flet and cl-labels :-)

They are good for introducing *new* bindings, not so for overriding locally.

>>>> but I am not sure if I can do anything here without introducing at-least an
>>>> extra keymap, to not install into the org-capture-mode-map, so I can as well
>>>> create a minor mode, but at this point it is not much different than
>>>> re-invinting the read-string, so I'll terminate my experiment here :).
>>>
>>> You can replace the buffer keymap with a keymap that only contain your custom
>>> keys, and inherits everything else from org-capture-mode-map.
>>
>> Isn't that what I wrote: introducing an extra keymap?
>> Of course I can solve the problem differently, but that was not what question
>> was about :).
>
> Right. Even when inheriting from the old keymap, it's still building a
> new keymap.  Sorry :-)
>
>
>> Well, I definitely understand you, and agree that overwriting function for
>> everyone and everything is not the best idea, but unfortunately bindings work as
>> they do in Emacs. I would prefer to have a local binding, with cl-flet, but this
>> does not work in Emacs:
>>
>> (defun my-read-string (prompt)
>>   (let ((delta 20 )
>>         (minibuffer-mode-map org-mode-map))
>>     (window-resize (minibuffer-window) delta)
>>     (cl-flet ((org-ctrl-c-ctrl-c ()
>>                 (interactive)
>>                 (let ((s (buffer-string)))
>>                   (exit-minibuffer) s))
>>               (minibuffer-mode () #'org-mode)
>>               (minibuffer-complete-and-exit () #'org-return)
>>               (org-kill-note-or-show-branches () #'keyboard-escape-quit))
>>       (read-string (concat "# Press C-c C-c to continue, C-c C-k to cancel\n# "
>>   prompt "\n\n")))))
>
> Yes. cl-flet looks safe to me :-)
>
>>
>> Hooks serve a different purpose. Advice can serve same purpose with exactly
>> same side effect, and some other limitations. With some care, let-binding is
>> still more "local" then advice. With other words, I agree with you about the
>> problems, but not with dogmatic approach that it should never be done, and
>> that hooks and advices are the replacement.
>
> Sorry if my words sounding dogmatic.
> Else, I agree too :-)
>
>
>>>
>>>> I am very interested to hear more on the topic, since I would definitely like to
>>>> learn more about different techniques.
>>>
>>> Variables are designed to be overriden (let bounds). Functions are not
>>
>> I have never heard before that functions are not designed to be overriden. I
>> think of them as two slots in a symbol structure; let creates bindings for value
>> slot, and flet for function slot. Functions are just objects or data as any
>> other value in lisp.
>>
>>> (as there is only one binding at any given time).
>>
>> Yes, unfortunately, in Emacs it is so;
>
> ok. We do really agree then :-)
>
>
>> but I don't think it should be > :).
>
> ... oh no ! ;-)
>
>
>>
>> There is an interesting package by Nick Ferrier
>>
>> https://github.com/nicferrier/emacs-noflet
>
>> but it does not seem to work, at least not for me.
>
> It's almost like a temporary advice ;-)
>
>
> About your use case, if what you need is asynchronous editing, maybe the
> with-editor package will be of interest to you:
>     https://github.com/magit/with-editor/blob/main/lisp/with-editor.el
>     
> It allows sub-processes to call Emacs for editing tasks. It's used by
> magit. It's easy enough to reuse. I've attached my attempt at it if
> you're interested.
>
> best,
>
> Bruno
>
> (cl-defun my-edit-async (finish &key mode buffer-name setup cancel)
>   "Open a buffer, let the user edit its content.
> Return the editing buffer.  Call FINISH in the editing buffer if
> the user validates his edit (C-c C-c).  When CANCEL is non-nil,
> call CANCEL in the editing buffer if the user cancels his
> edit (C-c C-k). When done, delete the buffer and its content.
>
> When MODE is non-nil, use it as the major-mode.  When BUFFER-NAME
> is non-nil, use it to generate a new unique name of the editing buffer.
> When SETUP is non-nil, call it in the edit buffer to setup the
> buffer before starting the edit."
>   (unless buffer-name (setq buffer-name "@Async edit"))
>   (let ((buf (generate-new-buffer buffer-name)))
>     (with-current-buffer buf
>       (when mode (funcall mode))
>       (when setup
>         (funcall setup))
>       (with-editor-mode 1)
>       (setq with-editor-previous-winconf
>             (current-window-configuration))
>       (add-hook 'with-editor-pre-finish-hook
>                 (lambda () 
>                   (funcall finish)
>                   (set-buffer-modified-p nil))
>                 nil :local)
>       (add-hook 'with-editor-pre-cancel-hook
>                 (lambda ()
>                   (when cancel (funcall cancel))
>                   (set-buffer-modified-p nil))
>                 nil :local)
>       (switch-to-buffer buf))
>     buf))
>
> (my-edit-async 
>  (lambda () (message "My edit:\n%S" (buffer-string)))
>  :cancel (lambda () (message "Canceled (discarded: %s)" (buffer-string)))
>  :setup (lambda () (insert "initial content") (goto-char (point-min))))
>

That looks very nice indeed. I am not aware of that package, I will definitely
use it somewhere, sometime. But with that we are getting now into 1K extra sloc
solution. With this experiment, I was mostly interesting to see how I can re-use
what already is in Emacs. Lisps are great for prototyping and writing new
software. Legend says that Steele was cranking out 10 intepreters a week at his
time :). I don't know how true it is, just read it in some blog, but the
point is that we are rather typing fast new pieces instead of learning how
to re-use stuff, which in the long run I believe is a bad habit, since we are
debugging bits that does the same what someone else already debugged. Don't get
me wrong, I have nothing against using someones package, certainly not
with-editor, seems like a good package; I am just talking about programming in
general.

This was also me trying to get better in Emacs Lisp, but I have to admit I am a
bit dissapointed we can't just override function bindings with cl-flet. Function
slot is just another slot :).

I am using cl-labels and cl-flet myself to introduce "local" functions, to not
pollute global namespace (symbol table), which they are good for, and to keep
code local where it is used, and I think they are also slightly more clear then
lambdas. They are good for that, unfortunately it is a bit of dissapoitment that
we can't locally bind functions slots other then actually overriding them globally.

And for the last time: I am not using this version of read-string, I don't need
it myself; it was just me thinking how to implement something after reading a
blog post. Anyway, thanks for the input, it was valuable to me.

regards
/a