From: Ihor Radchenko <yantar92@gmail.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: emacs-orgmode@gnu.org
Subject: Re: [feature request] A new cookie type [!] showing the last note taken
Date: Sun, 30 Aug 2020 20:18:29 +0800 [thread overview]
Message-ID: <873644xr6y.fsf@localhost> (raw)
In-Reply-To: <871rjo8kgr.fsf@nicolasgoaziou.fr>
> Again, on a given document, you can only guess what is the "last note".
> This is not reliable enough to extend the syntax.
I feel that my understand of "note" in context of org is different from
yours. Is there a formal definition of "note" in org?
If no, there is indeed no reliable way to capture "last note". However,
we can formalise the "last note taken" to "last note taken using
org-add-note".
> This implementation is only tangentially related to a "last note". You
> want to introduce some syntax to display the value a given property,
> here SUMMARY. But `org-add-note' is not the only way to add a note.
org-add-note is the only way I am aware about (except plain text,
indeed). That's why I wrote the function saving the last note taken
using org-add-note into SUMMARY. The property is only used here for
convenient retrieval, not because I implied showing a property value.
May I know what are the other ways to add note via interactive function
in Org?
Best,
Ihor
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Ihor Radchenko <yantar92@gmail.com> writes:
>
>> I was mainly referring to org-add-note. The last note taken with
>> org-add-note can be found quite reliably.
>>
>> I am using the following code saving the last note into :SUMMARY:
>> property upon exiting the note buffer. Though it may be an overkill, not
>> sure how easy would it be to parse the note syntax for notes created by
>> org-add-note.
>
> You cannot reliably.
>
>> (defvar yant/last-note-taken ""
>> "Text of the last note taken.")
>>
>> (define-advice org-store-log-note (:before (&rest args) yant/org-store-last-note)
>> "Store the last saved note into `yant/last-note-taken'."
>> (let ((txt (buffer-string)))
>> (while (string-match "\\`# .*\n[ \t\n]*" txt)
>> (setq txt (replace-match "" t t txt)))
>> (when (string-match "\\s-+\\'" txt)
>> (setq txt (replace-match " " t t txt)))
>> (when (string-match "\n" txt)
>> (setq txt (replace-match " " t t txt)))
>> (if (not (seq-empty-p txt))
>> (setq yant/last-note-taken txt))))
>>
>> (define-advice org-store-log-note (:after (&rest args) yant/org-save-last-note-into-summary-prop)
>> "Save the last saved note into SUMMARY property."
>> (when (and (not org-note-abort) (not (seq-empty-p yant/last-note-taken)))
>> (if (eq major-mode 'org-agenda-mode)
>> (org-with-point-at-org-buffer
>> (org-set-property "SUMMARY" (or yant/last-note-taken "")))
>> (org-set-property "SUMMARY" (or yant/last-note-taken "")))
>> (setq yant/last-note-taken nil)))
>
> This implementation is only tangentially related to a "last note". You
> want to introduce some syntax to display the value a given property,
> here SUMMARY. But `org-add-note' is not the only way to add a note.
>
> Again, on a given document, you can only guess what is the "last note".
> This is not reliable enough to extend the syntax.
>
> Regards,
next prev parent reply other threads:[~2020-08-30 12:20 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-29 6:40 [feature request] A new cookie type [!] showing the last note taken Ihor Radchenko
2020-08-30 8:50 ` Nicolas Goaziou
2020-08-30 10:40 ` Ihor Radchenko
2020-08-30 11:03 ` Nicolas Goaziou
2020-08-30 12:18 ` Ihor Radchenko [this message]
2020-08-30 12:57 ` Nicolas Goaziou
2020-08-30 14:58 ` Eric Abrahamsen
2020-08-31 2:26 ` Ihor Radchenko
2020-08-31 8:42 ` Julius Müller
2020-08-31 11:55 ` Ihor Radchenko
2020-08-31 14:58 ` Nicolas Goaziou
2020-09-02 2:02 ` Ihor Radchenko
2020-09-03 9:16 ` Nicolas Goaziou
2020-09-05 5:52 ` Ihor Radchenko
2020-09-09 14:00 ` Nicolas Goaziou
2020-09-10 9:24 ` Ihor Radchenko
2020-09-13 13:09 ` Nicolas Goaziou
2020-09-14 19:49 ` Eric Abrahamsen
2020-09-05 22:14 ` Allen Li
2020-09-06 1:23 ` Ihor Radchenko
2020-09-06 18:16 ` Eric Abrahamsen
2021-01-17 15:38 ` Christopher Miles
2021-01-18 2:07 ` Ihor Radchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=873644xr6y.fsf@localhost \
--to=yantar92@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=mail@nicolasgoaziou.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).