emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Samuel Banya" <sbanya@fastmail.com>
To: "Ihor Radchenko" <yantar92@gmail.com>
Cc: "Charles Berry" <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] Re: [BUG] Adding note to heading without newline at the end
Date: Mon, 27 Jun 2022 22:47:16 -0400	[thread overview]
Message-ID: <4ece8ee1-98cf-4e3a-95ba-406dfd12b644@www.fastmail.com> (raw)
In-Reply-To: <87o7yeo1e4.fsf@localhost>

[-- Attachment #1: Type: text/plain, Size: 2645 bytes --]

So I went through the same steps as before:
1. Pulled the latest Emacs Org Mode

2. Ran the following command in a terminal to get a clean Emacs without a config:
emacs -Q -L ./lisp -l org

3. Create a new org file

4.. Type (literally) the following:
* test

5. You will get a file containing "* test" exactly, no newline at the
   end

6. Do __not__ save the file

7. I then set the 'org-log-into-drawer' variable to true by evaluating the following environment variable with 'M-:':
'M-:' (setq org-log-into-drawer t)

This returned 't' in the minibuffer.

8.  I then used C-c C-c, and received the following example output:
```
* tes
:LOGBOOK:
- Note taken on [2022-06-27 Mon 22:38] \\
  Adding note with org-log-into-drawer enabled
:END:
t
```

Let me know if this is the desired output in that respect, or if this fulfills the weird edge case present.

Thanks,

Sam


On Mon, Jun 27, 2022, at 6:18 AM, Ihor Radchenko wrote:
> "Samuel Banya" <sbanya@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.kringeland@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
> 

[-- Attachment #2: Type: text/html, Size: 4094 bytes --]

  reply	other threads:[~2022-06-28  4:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20  0:27 [BUG] Adding note to heading without newline at the end Tor Kringeland
2022-06-20 13:41 ` Ihor Radchenko
2022-06-20 15:11   ` Tor Kringeland
2022-06-21  2:24     ` [PATCH] " Ihor Radchenko
2022-06-21 10:58       ` Tor Kringeland
2022-06-21 11:13         ` Tim Cross
2022-06-21 11:38         ` Ihor Radchenko
2022-06-22 14:28           ` Tor Kringeland
2022-06-23 15:59             ` Samuel Banya
2022-06-26 23:32               ` Samuel Banya
2022-06-26 23:45                 ` Ihor Radchenko
2022-06-27  2:42                 ` Samuel Banya
2022-06-27 10:18                   ` Ihor Radchenko
2022-06-28  2:47                     ` Samuel Banya [this message]
2022-06-28  2:57                       ` Ihor Radchenko
2022-09-13 14:13         ` Ihor Radchenko
2022-06-21  1:56 ` Samuel Banya
2022-06-21  2:21   ` Tor Kringeland

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=4ece8ee1-98cf-4e3a-95ba-406dfd12b644@www.fastmail.com \
    --to=sbanya@fastmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@gmail.com \
    /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).