0

The Org command org-add-note invokes a new buffer ready to create the text of a new note. How can I invoke that same editor for an existing note and have it update the note accordingly?

Adding a note is easy

The procedure for creating a note is straightforward:

  • Move point to the item where I want a note added.

  • Invoke org-add-note, bound by default to C-c C-z.

    • Emacs opens a separate window with a new buffer titled ‘*Org Note*’, and invite to “Insert note for this entry”. The buffer is already set to ‘Org’ mode.
  • Insert new text.

  • Press C-c C-c to signal the note is ready.

    • Emacs inserts the note into the document at the top of the current item. The text is indented so that it is not treated as a separate item.

    • The note is prepended with the text “- Note taken on [2022-10-26 Wed 16:13] \”.

That's all very convenient.

Editing a note should be just as easy, right?

What I'm lacking is a way to just as conveniently change the text of that note:

  • Move point to an existing note.

  • Invoke SOME-COMMAND.

    • Emacs opens a separate window with a new buffer and inserts the current text of the note, with leading indentation removed.

      N.B.: when editing an existing note I don't want to have to deal with the leading (automatically-added) indentation. This is one reason why I'm looking for an Org mode command that already knows how to deal with the indentation, removing it for edit, and restoring it when updating the document.

  • Edit the text of the note.

  • Press C-c C-c to signal the note is ready.

    • Emacs replaces the existing note with the updated text. The text indentation is restored, so that it is not treated as a separate item.

    • The timestamp is updated. Or maybe the existing timestamp is preserved, and a new timestamp is added to show when the edit was done.

What is the SOME-COMMAND in Org mode already that implements this, or near as I can get?

2
  • 1
    I don't know of a way to do what you are asking, although I don't think you need anything special for editing the note: since you are already in the note, you can just edit the text right then and there. Granted, the time stamp is not updated: you have to do it manually, although Cu C-c . will get you the current date with some difficulty: you have to delete the time and type . at the prompt - I don't know of a similar way to get the current time. For the time stamp, I would probably write an org-time-stamp-now command and bind it to some key.
    – NickD
    Oct 27 at 4:30
  • Actually, C-u C-u C-c . will modify the timestamp appropriately, so no need for org-time-stamp-now either.
    – NickD
    Oct 27 at 4:34

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.