[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with let/cl-letf binding stuff with org-capture
From: |
Arthur Miller |
Subject: |
Re: Problem with let/cl-letf binding stuff with org-capture |
Date: |
Sat, 11 Feb 2023 07:33:26 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Bruno Barbier <brubar.cs@gmail.com> writes:
> Arthur Miller <arthur.miller@live.com> 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
- Problem with let/cl-letf binding stuff with org-capture, Arthur Miller, 2023/02/10
- Re: Problem with let/cl-letf binding stuff with org-capture, Ruijie Yu, 2023/02/10
- Re: Problem with let/cl-letf binding stuff with org-capture, Bruno Barbier, 2023/02/10
- Re: Problem with let/cl-letf binding stuff with org-capture,
Arthur Miller <=
- Re: Problem with let/cl-letf binding stuff with org-capture, Bruno Barbier, 2023/02/11
- Re: Problem with let/cl-letf binding stuff with org-capture, Arthur Miller, 2023/02/11
- Re: Problem with let/cl-letf binding stuff with org-capture, Bruno Barbier, 2023/02/11
- Re: Problem with let/cl-letf binding stuff with org-capture, Arthur Miller, 2023/02/12
- Re: Problem with let/cl-letf binding stuff with org-capture, Bruno Barbier, 2023/02/12
- Re: Problem with let/cl-letf binding stuff with org-capture, Arthur Miller, 2023/02/12
- Re: Problem with let/cl-letf binding stuff with org-capture, Ihor Radchenko, 2023/02/12
- Re: Problem with let/cl-letf binding stuff with org-capture, Bruno Barbier, 2023/02/13
- Re: Problem with let/cl-letf binding stuff with org-capture, Arthur Miller, 2023/02/15
- Re: Problem with let/cl-letf binding stuff with org-capture, Bruno Barbier, 2023/02/15