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 SKsZFreEuWJOZwEAbAwnHQ (envelope-from ) for ; Mon, 27 Jun 2022 12:21:43 +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 0G3oFbeEuWLeXAEAauVa8A (envelope-from ) for ; Mon, 27 Jun 2022 12:21:43 +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 DAC402BB3F for ; Mon, 27 Jun 2022 12:21:42 +0200 (CEST) Received: from localhost ([::1]:49616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5lsE-0008Og-19 for larch@yhetil.org; Mon, 27 Jun 2022 06:21:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39768) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5lnz-00052J-Ic for emacs-orgmode@gnu.org; Mon, 27 Jun 2022 06:17:19 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]:41664) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5lnw-0003yr-Lu for emacs-orgmode@gnu.org; Mon, 27 Jun 2022 06:17:18 -0400 Received: by mail-pl1-x630.google.com with SMTP id c4so7750437plc.8 for ; Mon, 27 Jun 2022 03:17:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=DC7LzCIRUJ3rEflIA5PReD6Z3MDuCYNTy1rayjISG80=; b=LkfCjdQFLzSpknSHFEkSsrdnfE9fSd0iZogz8pdAOOvycb9K290xboPyAX0i+AfePs Q8HKMISob85+DIyAB8HuMh1EBFnOy96qE9ybaxJFecaiuVTzvDSyunyMo9QRCS2cmlWZ U8pw/bH6sVSFEOr2sGmtz0CWU++tP3huAm0zBJq+BzA2bCws2kuQS7OhV7Tj/yBrcIYH PCIxd80YIrKmj05ZVlAcC3Nf3QTPkbAKcSjgu/7K4SCDDMdNbvOmWVx7l1ER4zeqxXFz 277maQmoDlriS+OVvH1q2zYTU3rjpNtVFgcFTDfRu5TD8a3ufjc2ok56Nxi9g2epVeqk jkWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=DC7LzCIRUJ3rEflIA5PReD6Z3MDuCYNTy1rayjISG80=; b=qWuMwhOxtoFCbDXGXVQRhYLFpgpEmPEQ5CdKbGgKTA5l/5rrM93gTUa/z7vRjI5hEq ZhBkbYnSzawBBN7Calz+UzTcY4e800t644lCpVBzTb/FXxuZ+bZTqw1i4aL5/cf7YLpB uDhQkw8ZK7BMd6btTUwXzpWTjfui1VWxEm5ngh57CqffohErejKTzOe2L2Jr5lZfRXr5 TMY/LvvPEvr7hs+yZRrw7758cqmsQxZPJhIW8mcVuJWBinA2hkL1cCCPhA7sxjgOaWez teHIRRnkEyor8HE7TcLTOOzl15jLoB0nNi+H1zm+LerZrv+hx5f1AmIis232hMFrn0jd VKQg== X-Gm-Message-State: AJIora9Xubv1iH69RHxC/O41eaWGoGngt8blSBQ1r1ydj0zqCry6JQAc fbheGP/AsO2kjgJX+DVKFeVC558zXlU= X-Google-Smtp-Source: AGRyM1uCXiSAgVcGnJgjNEojenPRWiGf4dDsRonZIjsdgY79Tfp0YMr3cgDNoMG/C8ZmGQqUk9wU7g== X-Received: by 2002:a17:90b:164a:b0:1ec:b991:b69 with SMTP id il10-20020a17090b164a00b001ecb9910b69mr20070091pjb.173.1656325035176; Mon, 27 Jun 2022 03:17:15 -0700 (PDT) Received: from localhost ([64.32.23.62]) by smtp.gmail.com with ESMTPSA id f80-20020a623853000000b005252380a87bsm6838776pfa.59.2022.06.27.03.17.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:17:14 -0700 (PDT) From: Ihor Radchenko To: Samuel Banya Cc: Charles Berry Subject: Re: [PATCH] Re: [BUG] Adding note to heading without newline at the end In-Reply-To: <62e3e328-a40e-4e81-a552-5fada3182859@www.fastmail.com> 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> Date: Mon, 27 Jun 2022 18:18:27 +0800 Message-ID: <87o7yeo1e4.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=yantar92@gmail.com; helo=mail-pl1-x630.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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=1656325302; 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=DC7LzCIRUJ3rEflIA5PReD6Z3MDuCYNTy1rayjISG80=; b=N95s6lxkXZlxv6Ox5gY8B04l1mONiHfPTTYQfZI3rN2yC/ls+vaf3zv+qSCmw14KHbGd5E lxm1nP4yjJUm4CWMkr45QwOs+b4J8t1jr7DlpoT8D3wWESGxlygOoYWozvLUdgmvMP30oh wSy/vBeqMU6sLzpcmOI4A7qu1GLyI3DtUyzgIDrqVNzwldGhu4+36XnEs1Guo2vWknEDGi FH81j0fmQcImHNrFch9Ho5pV/qnT8J7Fe1BfReo1UCTqK4yNk+YIC67oLeFR/rdn7yCpVp 8tFqCjpFvue8G7JS/l8kLHG5lp4sZ5ejzaFcWSftIiQUq1KAbaz96Yle6bfGWw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1656325302; a=rsa-sha256; cv=none; b=u28idAsMZzEUDZSaxe0MLsPIUmHPB2Eg/vLakZuSLCBmixIHVkdtN/mp8CojZP0hnRgMua emREuJCPcetosrYEC6WrJdX4MLDp5dhEIeSWfsD6sykRuvbIU1xSjj8Tw2araVcdgceBR0 Hs7ble6aaQ43+G7ag9mVETsynOW5Uid4keA1wsbB2k9U9FfM2AeTSaa2ZWYdBisst79iWF yDx1yZKvwfuVCJPN6VGyDHLLK55uwTnkagVvwgUc0dZfaKIHuRSP31pATwDchspx3kuo5h y/dlDghLDxOPKcxfGxb030zqCkm0TpV6nPMyKE+sderr+c+fBD9SkLd0eji86A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=LkfCjdQF; dmarc=pass (policy=none) header.from=gmail.com; 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: -3.45 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=LkfCjdQF; dmarc=pass (policy=none) header.from=gmail.com; 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: DAC402BB3F X-Spam-Score: -3.45 X-Migadu-Scanner: scn1.migadu.com X-TUID: bZvj9nfLtegu "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