"Samuel Banya" <sba...@fastmail.com> writes: > I checked 'org.el' which has the related 'org-add-note' function present. > > This appears to call the 'org-add-log-setup' function, and passes the 'note' > argument to it. > > I then took a look at the 'org-add-log-setup' function. > > From the bug's nature itself, it most likely is moving the cursor incorrectly > to the previous line above it, when it should be really doing it on the line > AFTER it. > > This to me is probably the 'moving' section that should be modified: > ``` > (move-marker org-log-note-marker (point)) > ``` > > It's probably the position that needs to be recalculated or adjusted > accordingly.
The offending function is different. This piece of code is admittedly slightly tricky - org-add-log-setup does not determine where the note will be inserted. It defers note taking to org-add-log-note, which, in turn defers saving the note text to the time user presses C-c C-c in the note buffer. The function doing the actual insertion is org-store-log-note and the function determining where to insert the note is org-log-beginning. Note that the patch I attached in my earlier message contains the fix. What is left is studying a similar edge case reported in the reply to my patch: Tor Kringeland <tor.kringel...@ntnu.no>: >> Thanks! This fixes the bug (which was present in both Org 9.5 and 9.6) >> for me. However, my original bug, which is only present in Org 9.6, is >> still there. Do the same thing but set org-log-into-drawer to t. Then That is, you need to follow the same steps, but set org-log-into-drawer to t before creating a note. Best, Ihor