From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 0Ca7Gwx9umLSqwAAbAwnHQ (envelope-from ) for ; Tue, 28 Jun 2022 06:01:16 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id SMlzGwx9umLdvAAAauVa8A (envelope-from ) for ; Tue, 28 Jun 2022 06:01:16 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 2473D9821 for ; Tue, 28 Jun 2022 06:01:15 +0200 (CEST) Received: from localhost ([::1]:34040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o61HV-00022t-No for larch@yhetil.org; Mon, 27 Jun 2022 22:48:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51004) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o61GS-00022D-Kb for emacs-orgmode@gnu.org; Mon, 27 Jun 2022 22:47:44 -0400 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:40953) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o61GQ-0007At-5Z for emacs-orgmode@gnu.org; Mon, 27 Jun 2022 22:47:44 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 4F033320091D; Mon, 27 Jun 2022 22:47:38 -0400 (EDT) Received: from imap50 ([10.202.2.100]) by compute5.internal (MEProxy); Mon, 27 Jun 2022 22:47:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm2; t=1656384457; x=1656470857; bh=OtL08hLQrk s2TH1tKa+sXiV2M0bWLPzv5tqiBrtAh1I=; b=Ze9cxn/OO922l3wSXZwAXK9UNt Y2dwAoN19wRiObsuqZsvxuiBT1IS9qD1NqbzVe98Aoo7iW45DewESbaYCY44y4gT Rvrw9njmb3RWlgkXs9Bx9xTQ9cY/FoUb9S3Mpsi/APnwOaNwJtIedCngJ1NiJ6K+ iD51FW4jNy6dl8gOxliCkn59JsHTk4qYK1TFcZYKXucOimoc4GPl9dVyyyNIEKqx g/mt7V+nI4i5lGa4IoPTxGtJtW7lHRSdlJK7GOHZ9Offsfh8ShnB7r26qDCPIkaI +0ZPrMqRLawOCW53t099/djCTFx44y6vVB4yvCVhpyjU7MjdCtaXKcvzwYGg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1656384457; x=1656470857; bh=OtL08hLQrks2TH1tKa+sXiV2M0bW LPzv5tqiBrtAh1I=; b=rh0II9VtsHJVroSagDa1/pzzNSKkW09ul+KK/+ZE36dp FcbGquQXJVOYq/5UhF8jbZpU1h5s5jSLCd65pMFiR/bEViE/xIvIwSF8zjB2+IDt K+lv2Rh2PDRUFHUXVUEYWqbuf1Ni/1pwLQ2Ijw30CufAoBMuECE+RgPauDOxjwhY buij1AQXDVpz242xS2QMvosAmp1//GyhzZ1+LXTErhbJCdtcu8/MBn8OmCFlVVf/ ObJxQEAmidCvTt8URhBaVO1bQU7c7AhPgd9fzdWPFWWItJlsqQIg5wzgkDgqOUCs LAN9V2yOQDdsNK7gGunWkeddss3nRqPu6R/Exn+z8g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudegiedgieeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfgjfhffhffvvefutgesrg dtreerreertdenucfhrhhomhepfdfurghmuhgvlhcuuegrnhihrgdfuceoshgsrghnhigr sehfrghsthhmrghilhdrtghomheqnecuggftrfgrthhtvghrnheptdetieeutdeitdejke ekvdduudehffeugefhleehfeefudffgfeutdfhvdduteffnecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshgsrghnhigrsehfrghsthhmrghilh drtghomh X-ME-Proxy: Feedback-ID: ib97947f6:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 8A5CA1700077; Mon, 27 Jun 2022 22:47:37 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-713-g1f035dc716-fm-20220617.001-g1f035dc7 Mime-Version: 1.0 Message-Id: <4ece8ee1-98cf-4e3a-95ba-406dfd12b644@www.fastmail.com> In-Reply-To: <87o7yeo1e4.fsf@localhost> References: <87o7yn3117.fsf@localhost> <87fsjysqhk.fsf@localhost> <87letqqmad.fsf@localhost> <8160125c-131b-4623-85fe-e8747718273e@www.fastmail.com> <62e3e328-a40e-4e81-a552-5fada3182859@www.fastmail.com> <87o7yeo1e4.fsf@localhost> Date: Mon, 27 Jun 2022 22:47:16 -0400 From: "Samuel Banya" To: "Ihor Radchenko" Cc: "Charles Berry" Subject: Re: [PATCH] Re: [BUG] Adding note to heading without newline at the end Content-Type: multipart/alternative; boundary=8795b70d472a4cdc829994791adf1d2e Received-SPF: pass client-ip=64.147.123.19; envelope-from=sbanya@fastmail.com; helo=wout3-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1656388876; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=OtL08hLQrks2TH1tKa+sXiV2M0bWLPzv5tqiBrtAh1I=; b=ocAChQZAgn6JugYLh/NL5ljBKK6LNYPH89U9DxeL4D46P+1doKq/4dOjlh2J2CU5fU9WyR J/MfsJHVvstnF4eheRYq5cwS6dmebrK7ucMRe5xFFzgX8BxVdsHwN5ZLQaUvejtPEcE1i6 6EFm0AqMUpHfv6kzsEM15lhlJFc62diVxUOSbEAvz2V+N4D+FxkhqsLVUAiL116xBjrdji f1Muof3htnlWQMoAtamyROJQSWjSKqZ/rcCsqDXs1wKqP5823/GXl4tZFypg7QO2q6GjI7 CucvSrQiLmY5qh23pj5Zc4wGV064mJAEK62enpvXsnN0676GFWVxN4n6xE8VYQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1656388876; a=rsa-sha256; cv=none; b=st1TPiDURYvQSpQNPO09a4ndHP4bMMG3mKXukEaLNS4zkN3heo9KCOplUse79+6lKJdlk1 GIamrsOfTGMMQ1XNHg1UzLXLeXJ3S3pf6iPb+Km2rA/aSTpsLhuXeY5lcH6A7WqcHzqTTF oIMY3x07UZBPwcH42FGuzO8EkX8EpoNNp6+07kEKPG/Yus6KnYL3krkajYswkK/KVWt0zD Yt4GhBe/m0JC1ulPsJHJ7DIQTqD4nFn+QTP5XExetM0Y4Nwe8fUJfYSSyf7JsZBtaCAEKC qTuCD+eV1e7nLlRij99RY6YU7/UrQG/nxNJTVPFqAh1hyZrMaN4p9/ziNGDM1Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=fastmail.com header.s=fm2 header.b="Ze9cxn/O"; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm2 header.b=rh0II9Vt; dmarc=fail reason="SPF not aligned (relaxed)" header.from=fastmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 7.86 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=fastmail.com header.s=fm2 header.b="Ze9cxn/O"; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm2 header.b=rh0II9Vt; dmarc=fail reason="SPF not aligned (relaxed)" header.from=fastmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 2473D9821 X-Spam-Score: 7.86 X-Migadu-Scanner: scn0.migadu.com X-TUID: H0j2al67DGIm --8795b70d472a4cdc829994791adf1d2e Content-Type: text/plain 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" 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 : > >> 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 > --8795b70d472a4cdc829994791adf1d2e Content-Type: text/html Content-Transfer-Encoding: quoted-printable
So I went throu= gh the same steps as before:
1. Pulled the latest Emacs Or= g Mode

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

3. Create a new org file
<= /div>

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

5. You will get a file containing= "* test" exactly, no newline at the
   end
<= /div>

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-:':
<= div>'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:
- Not= e taken on [2022-06-27 Mon 22:38] \\
  Adding note wi= th org-log-into-drawer enabled
:END:
t
```

Let me know if this is the des= ired output in that respect, or if this fulfills the weird edge case pre= sent.

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-setu= p' 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 th= at should be modified:
> ```
> &n= bsp; (move-marker org-log-note-marker (point))
> ```
>
> It's probably the position that need= s to be recalculated or adjusted accordingly. 

The offending function is different. This piece of code is admi= ttedly
slightly tricky - org-add-log-setup does not determ= ine where the note
will be inserted. It defers note taking= to org-add-log-note, which, in
turn defers saving the not= e text to the time user presses C-c C-c in the
note buffer= .

The function doing the actual insertion i= s org-store-log-note and the
function determining where to= insert the note is org-log-beginning.


--8795b70d472a4cdc829994791adf1d2e--