From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id QJ4VNAEceF/VTwAA0tVLHw (envelope-from ) for ; Sat, 03 Oct 2020 06:36:49 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id aKfeLwEceF/1NQAA1q6Kng (envelope-from ) for ; Sat, 03 Oct 2020 06:36:49 +0000 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 E15AF9401DF for ; Sat, 3 Oct 2020 06:36:48 +0000 (UTC) Received: from localhost ([::1]:40360 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOb9z-0001Mb-K6 for larch@yhetil.org; Sat, 03 Oct 2020 02:36:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38954) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOb9Y-0001MT-RZ for emacs-orgmode@gnu.org; Sat, 03 Oct 2020 02:36:21 -0400 Received: from pb-smtp21.pobox.com ([173.228.157.53]:56123) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOb9W-0006IW-5H for emacs-orgmode@gnu.org; Sat, 03 Oct 2020 02:36:20 -0400 Received: from pb-smtp21.pobox.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 92599E797A; Sat, 3 Oct 2020 02:36:15 -0400 (EDT) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:in-reply-to:references:date:message-id:mime-version :content-type; s=sasl; bh=ARq2dHcFnxWE0IEde+oOZ7vkOXg=; b=g7vapD nIJxuC/fASyQZHDkAMoc9jEpNBTjHx19tO7AypA89sozLNW0M9LOttUvJAXnhpB0 H13WJNrlqXyqyQrGLfkdmHsxa7CWmp0HO7TngMWyH2qub2UwJITzdWj1BAgd0EZF FY7bzH4y4vz0J1sIsehJMtPxaNQceFivd+rRc= Received: from pb-smtp21.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 8A43BE7979; Sat, 3 Oct 2020 02:36:15 -0400 (EDT) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=kyleam.com; h=from:to:cc:subject:in-reply-to:references:date:message-id:mime-version:content-type; s=mesmtp; bh=D4rNbbfefIrF9F2H5gCtH6tiEFjVWpZK62xc0l6GwBs=; b=b49DTgUzGux1lpHRiy76TJDF7XqISgTWNwfXPA07yRkaUfZWrCaC/5wtc054vLIuWZ+hGI4q33aoHi1NBbbg8lPG3ybbmP6sWUanZVOUY4BwZ1/LeeI4WvNeLYtlzHvzeZlmgIKbxGKj7UDtQDzvFS9RwECN9HPbuwsiAzfo4dY= Received: from localhost (unknown [45.33.91.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp21.pobox.com (Postfix) with ESMTPSA id F16D6E7974; Sat, 3 Oct 2020 02:36:12 -0400 (EDT) (envelope-from kyle@kyleam.com) From: Kyle Meyer To: No Wayman Subject: Re: org-capture at point In-Reply-To: <87ft6wwjnr.fsf@gmail.com> References: <87lfgrdegt.fsf@gmail.com> <87ft6wwjnr.fsf@gmail.com> Date: Sat, 03 Oct 2020 02:36:06 -0400 Message-ID: <877ds7ke95.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: BB1B3650-0542-11EB-94F9-843F439F7C89-24757444!pb-smtp21.pobox.com Received-SPF: pass client-ip=173.228.157.53; envelope-from=kyle@kyleam.com; helo=pb-smtp21.pobox.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/03 02:36:15 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=pobox.com header.s=sasl header.b=g7vapD n; dkim=pass header.d=kyleam.com header.s=mesmtp header.b=b49DTgUz; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -1.21 X-TUID: zKoMorbAcjIz No Wayman writes: >> Looks like it was introduced with: >> >> f5573e6a0 org-capture.el: Fix heading's level when inserting a >> template "here" > > I believe the issue is due to `org-back-to-heading' moving point > when calculating the heading level. > The attached patch corrects the issue on my end. Thank you! > Subject: [PATCH] org-capture.el: Fix heading's position when inserting a > template "here" > > * lisp/org-capture.el (org-capture-place-entry): Fix heading's > position when inserting a template "here" with C-0 M-x org-capture. > --- > lisp/org-capture.el | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/lisp/org-capture.el b/lisp/org-capture.el > index 67c58ffdd..020feb4d6 100644 > --- a/lisp/org-capture.el > +++ b/lisp/org-capture.el > @@ -1150,10 +1150,11 @@ may have been stored before." > (insert-here? > ;; FIXME: level should probably set directly within (let ...). > (setq level (org-get-valid-level > - (if (or (org-at-heading-p) > - (ignore-errors (org-back-to-heading t))) > - (org-outline-level) > - 1)))) > + (if (or (org-at-heading-p) > + (ignore-errors > + (save-excursion (org-back-to-heading t)))) > + (org-outline-level) > + 1)))) This looks correct to me, and AFAICT this doesn't break the scenario that prompted the code you're adjusting from f5573e6a0: https://orgmode.org/list/87lfiuxqze.fsf@alphaville.usersys.redhat.com/ Applied (8d3610df0), extending the commit message with a Reported-by trailer and link for https://orgmode.org/list/877dscaila.fsf@dwrz.net/