From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id mFYdK0VhOmGGGAEAgWs5BA (envelope-from ) for ; Thu, 09 Sep 2021 21:32:21 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id IKPtJkVhOmE3FAAA1q6Kng (envelope-from ) for ; Thu, 09 Sep 2021 19:32:21 +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 3BDBB25BAA for ; Thu, 9 Sep 2021 21:32:21 +0200 (CEST) Received: from localhost ([::1]:36750 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mOPmV-0005Hx-Ve for larch@yhetil.org; Thu, 09 Sep 2021 15:32:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mOPlW-0005Hj-C7 for emacs-orgmode@gnu.org; Thu, 09 Sep 2021 15:31:18 -0400 Received: from senat.jabatus.fr ([109.234.163.56]:57498) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mOPlU-0003h8-Bh for emacs-orgmode@gnu.org; Thu, 09 Sep 2021 15:31:18 -0400 X-MailPropre-MailScanner-From: victor@svictor.net X-MailPropre-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-1.06, required 5, autolearn=disabled, GMAILCOM 0.01, RCVD_IN_DNSWL_HI 0.01, SPF_HELO_PASS -0.10, SPF_PASS -1.00, SUKE_2 0.01, TOGMAIL 0.01) X-MailPropre-MailScanner: Not scanned: please contact your Internet E-Mail Service Provider for details X-MailPropre-MailScanner-ID: ACD54100443.ABE5C X-MailPropre-MailScanner-Information: Please contact the ISP for more information DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=svictor.net ; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :Date:In-reply-to:Subject:Cc:To:From:References:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=L62OYuYuKU8rDRWos8gKbLOvZi4vVz0rgQpGTBNXwU8=; b=nwoUJ8rWJihRn3nVHOWIUcwJm6 0ewsQHKDkgJ1r/vau6lXEbuxfJqUvciP4CZfIc67VMuLYMpTQmq7pRumt6MUAWuJPjt6QRgLylpPU MX9Y/bVvo8Y06thIWesh0BCRE0SKEL2L+qgaXTcifdH7Jf187wXGMDjkWEgNSwosNJvs=; References: <87lf4594t3.fsf@svictor.net> <87y285vats.fsf@gmail.com> From: "Victor A. Stoichita" To: Marco Wahl Subject: Re: behavior of (org-insert-heading-respect-content) In-reply-to: <87y285vats.fsf@gmail.com> Date: Thu, 09 Sep 2021 21:29:05 +0200 Message-ID: <87ilz98s5a.fsf@svictor.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - pam.o2switch.net X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - svictor.net X-Get-Message-Sender-Via: pam.o2switch.net: authenticated_id: victor@svictor.net X-Authenticated-Sender: pam.o2switch.net: victor@svictor.net X-Source: X-Source-Args: X-Source-Dir: Received-SPF: pass client-ip=109.234.163.56; envelope-from=victor@svictor.net; helo=senat.jabatus.fr X-Spam_score_int: 6 X-Spam_score: 0.6 X-Spam_bar: / X-Spam_report: (0.6 / 5.0 requ) BAYES_50=0.8, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H2=-0.001, 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 Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1631215941; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=L62OYuYuKU8rDRWos8gKbLOvZi4vVz0rgQpGTBNXwU8=; b=BNQF0g5d2wfQZ6LCD15TBELlFKc7ooYDj8iN6pytpH+iLt4ap6bXSwkGRHO2YoEYEoSYqr wfwkWNH060Bf/NvsYutMIuKXh5o+5gOXaMpDQNVfxbXFOuYlR/xnSbG1IDZWRCB7WFQfM8 qcjpV6cPE4b5Z6x0ksR+fy6z4sz7xqhBaWl85skIce4QsY6gzSMx0zakmsN16TYL3rFEQG d+0fxbZu/2RN1t2zbS33ZXUZNS2Uu5mGRnJtvo57IAaOCBdiGf95u/JQ+ORO5NFS1Fx7bh w3oroHJMiLRwVDaqgB0ik8Yhvg0Sl5ifIXqWYft92HcBokrYvmAvQJuybc8BTw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1631215941; a=rsa-sha256; cv=none; b=nX+VIR2T8Xo4oE+FxtMzuiBrtHgV0SwcUnX/26elSVIO+DMJwkF47SuwApapfZ5T9mguXW hYdZlJAR+WmRzR5GRs1r0KFRIwEzL3TgDZiQQchISWYwVPLONHu9eZUKhr/YwNQQD1RCd9 kiWJrpSQhEmrxNTNMPk0llfHI6u5uaHtH3rDbmluMDZwJWO/2RzStJq3aYyYf153gEyejD bmEh8Yk1kFmg7DzPMxu3nGBBU0nMSSGIFmPPQt0O4l8v5WxJIMhRivuV5FOZN16DyJ+luw OxNJdmUkwszEfr/QPzPaojLf+Xy8rYRtquDZoqt8LT9605/5B3i79Er6vQfuBw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=svictor.net header.s=default header.b=nwoUJ8rW; 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-Migadu-Spam-Score: -1.41 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=svictor.net header.s=default header.b=nwoUJ8rW; 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-Migadu-Queue-Id: 3BDBB25BAA X-Spam-Score: -1.41 X-Migadu-Scanner: scn0.migadu.com X-TUID: 8Phz0WPeO6d2 Le 09 Sep 2021, Marco Wahl a =C3=A9crit : > My impression is that org-insert-heading-respect-content should be > called only with point in a subtree. > > The fix would be to signal an error when point is not located in a > subtree. > > Does this sound reasonable? In a way, yes. I guess that the error would not appear too often. But falling back gracefully to org-insert-heading could be even better, especially when org-insert-heading-respect-content is called from Lisp (rather than interactively). For now, I use this and it seems to do the job: #+begin_src elisp (if (equal 1 (line-number-at-pos nil t)) (org-insert-heading) (org-insert-heading-respect-content)) #+end_src If I=E2=80=99m not mistaken, org-insert-heading-respect-content works as ex= pected even when point is not in a subtree. It seems to only fail if point = is on the 1st line.=20 Regards, Victor