* How can I use org-add-note with emacsclient?
@ 2023-12-24 3:50 equal.moon0346
2023-12-25 14:35 ` Ihor Radchenko
0 siblings, 1 reply; 3+ messages in thread
From: equal.moon0346 @ 2023-12-24 3:50 UTC (permalink / raw)
To: emacs-orgmode
Hello Org mode users,
I'm trying to figure out how to start a note (C-c C-z) on the currently clocked task from emacsclient. Here's what I have so far:
Start Emacs:
emacs --fg-daemon=test -Q -nw --eval "(setq-default org-agenda-files '(\"~/org-agenda-files\"))"
Connect to the daemon in a different terminal, load the agenda:
emacsclient -s test -nw --eval '(org-agenda nil "a")'
^ In this frame I'll also clock in to some heading with I in the agenda. Then I close the terminal.
In another terminal, try to start a new note on the currently clocked task:
emacsclient -s test -nw --eval '(progn (org-clock-goto) (org-add-note))'
This seems to have no effect. Oddly, if I paste this into M-:, it works fine. I've tried a number of things with e.g. plain capture templates that run the above code :after-finalize, using call-interactively, etc. After a cursory reading through the info manual on interactivity I find I'm still a bit lost. Can anyone explain what I'm doing wrong and hopefully point me to the right manual page to read on this?
Thanks and Happy Holidays!
Moon
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How can I use org-add-note with emacsclient?
2023-12-24 3:50 How can I use org-add-note with emacsclient? equal.moon0346
@ 2023-12-25 14:35 ` Ihor Radchenko
2023-12-26 16:35 ` equal.moon0346
0 siblings, 1 reply; 3+ messages in thread
From: Ihor Radchenko @ 2023-12-25 14:35 UTC (permalink / raw)
To: equal.moon0346; +Cc: emacs-orgmode
equal.moon0346@fastmail.com writes:
> I'm trying to figure out how to start a note (C-c C-z) on the currently clocked task from emacsclient. Here's what I have so far:
> ...
> emacsclient -s test -nw --eval '(progn (org-clock-goto) (org-add-note))'
>
> This seems to have no effect. Oddly, if I paste this into M-:, it works fine. I've tried a number of things with e.g. plain capture templates that run the above code :after-finalize, using call-interactively, etc. After a cursory reading through the info manual on interactivity I find I'm still a bit lost. Can anyone explain what I'm doing wrong and hopefully point me to the right manual page to read on this?
`org-add-note' is implemented a bit awkwardly using post-command-hook,
which makes it work only interactively.
The hook does not trigger when you use --eval. That's why you are not
seeing the note buffer after running the above shell command.
What you can do is manually call the function used to raise the note
buffer:
emacsclient -nw --eval '(progn (org-clock-goto) (org-add-note) (org-add-log-note))'
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How can I use org-add-note with emacsclient?
2023-12-25 14:35 ` Ihor Radchenko
@ 2023-12-26 16:35 ` equal.moon0346
0 siblings, 0 replies; 3+ messages in thread
From: equal.moon0346 @ 2023-12-26 16:35 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
On Mon, Dec 25, 2023, at 14:35, Ihor Radchenko wrote:
> equal.moon0346@fastmail.com writes:
>
>> I'm trying to figure out how to start a note (C-c C-z) on the currently clocked task from emacsclient. Here's what I have so far:
>> ...
>> emacsclient -s test -nw --eval '(progn (org-clock-goto) (org-add-note))'
>>
>> This seems to have no effect. Oddly, if I paste this into M-:, it works fine. I've tried a number of things with e.g. plain capture templates that run the above code :after-finalize, using call-interactively, etc. After a cursory reading through the info manual on interactivity I find I'm still a bit lost. Can anyone explain what I'm doing wrong and hopefully point me to the right manual page to read on this?
>
> `org-add-note' is implemented a bit awkwardly using post-command-hook,
> which makes it work only interactively.
> The hook does not trigger when you use --eval. That's why you are not
> seeing the note buffer after running the above shell command.
>
> What you can do is manually call the function used to raise the note
> buffer:
>
> emacsclient -nw --eval '(progn (org-clock-goto) (org-add-note)
> (org-add-log-note))'
Thanks, this works! I'm curious as to why though. Shouldn't something like call-interactively solve this problem too? I'm thinking it has something to do with how the command loop works that I don't understand.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-12-26 16:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-24 3:50 How can I use org-add-note with emacsclient? equal.moon0346
2023-12-25 14:35 ` Ihor Radchenko
2023-12-26 16:35 ` equal.moon0346
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.