legalnonsense / org-clones

Prototype for method of cloning orgmore headers
GNU General Public License v3.0
36 stars 5 forks source link

Fixing body functions and defining the "body" of a node #2

Open legalnonsense opened 4 years ago

legalnonsense commented 4 years ago

Taken from reddit (https://www.reddit.com/r/emacs/comments/iks94o/annrfc_orgclones_orgmode_headings_in_multiple/)

Consider a heading containing list with checkboxes. If the heading has RESET_CHECK_BOXES property set to t, org-mode will attempt to modify the checkboxes in the heading body. Not sure if cursor-sensor-mode will catch this edit. Even if it does, org-mode will error unexpectedly.

Similar problem may happen when one uses default setting for org-log-into-drawer (nil). Adding notes involves org-add-note, which uses separate buffer to get the note text and then inserts the note text into the heading body.

Finally, one may use capture template to add a new list element or table line into cloned headline. I suspect that crazy staff may happen in such a scenario.

legalnonsense commented 4 years ago

Capture template problem seems solved with adding (sync-clones) as a hook to org-capture-after-finalize-hook. One down, two to go.

legalnonsense commented 4 years ago

It is easy enough exclude a note added with org-add-note. If the goal is to include them, then it is more complicated because it does not seem like org-add-note runs any associated hook. I guess you could do it via advice.

legalnonsense commented 4 years ago

Also none of these editing functions trigger the cursor sensor, so there's no issue with read-only properties, and drawers following a headline are not considered part of the body, so logging into a drawer would not need to be synced unless the logbook is elsewhere in the body, so I guess it is the same problem involving org-add-note and the same advice would solve it.

yantar92 commented 4 years ago

It is easy enough exclude a note added with org-add-note. If the goal is to include them, then it is more complicated because it does not seem like org-add-note runs any associated hook. I guess you could do it via advice.

That probably make sense to exclude notes - they are often associated with TODO keyword changes. Since TODO keywords are not synced, there is little reason to sync the notes.

yantar92 commented 4 years ago

, so logging into a drawer would not need to be synced unless the logbook is elsewhere in the body, so I guess it is the same problem involving org-add-note and the same advice would solve it.

The problem is probably not when logging is done into drawer. By default, logging is done outside drawer, directly into the heading body.