From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id KACdDTKlP2F+1QAAgWs5BA (envelope-from ) for ; Mon, 13 Sep 2021 21:23:30 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id gCc2CTKlP2EGZAAAbx9fmQ (envelope-from ) for ; Mon, 13 Sep 2021 19:23:30 +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 6E15D2A31A for ; Mon, 13 Sep 2021 21:23:29 +0200 (CEST) Received: from localhost ([::1]:33172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPrY7-0005kZ-G2 for larch@yhetil.org; Mon, 13 Sep 2021 15:23:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56084) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPrWu-0005jH-HP for emacs-orgmode@gnu.org; Mon, 13 Sep 2021 15:22:12 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:40817) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPrWs-0004oz-LR for emacs-orgmode@gnu.org; Mon, 13 Sep 2021 15:22:12 -0400 Received: by mail-wm1-x333.google.com with SMTP id b21-20020a1c8015000000b003049690d882so154679wmd.5 for ; Mon, 13 Sep 2021 12:22:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:message-id:user-agent :mime-version:content-transfer-encoding; bh=zGq98KVq0kpq3+y0vJKov2nuN5MPY/6QQttyVWsqpFc=; b=jqB04Bf3MV0G/rFD6GXz1edTGOxImpnew7SLZArFhNHsQZgqsnpDqFYYAvUswnKzNu iNUA9XRib6jEo3ywZK1ivmp1WpP114yfhgXWaNsTfAi6KHGn622T9VRlX2zl7OQsuRer 90AmV7hMSH+djIvyIJ4M/916hRTl7Vw3UwMFBjOqiiGS5M/86lniCT28HK+9lt4IIgH0 Y7i4fV1GWGuyyDx+gAENDg6PQrKEhvG1TYrce9xYzFbOVb6fnjzdXaJ9zjK35pKiULh9 53NUVwQLkcBIUCfOzXpqN7w37GLWxDuhnEi6H9rrhko2TvZkQr164cryE/7iHAQ3enHY yB7w== 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:references:date:message-id :user-agent:mime-version:content-transfer-encoding; bh=zGq98KVq0kpq3+y0vJKov2nuN5MPY/6QQttyVWsqpFc=; b=Ji7xfJaBMixrg09pr2SxK8deZUROOI2ASWM69eo/OMMcMPegrvrT1cz/erfLjj1G9f 8gSnPjoo31d2ISnNnVK2WIJSlPiX4azyRP427YI/YGzAu0ChQ5TujI9gFGQGAmRLFwln BeEGUhicpXvSCTLBL+nF1iIqrYposKTRp38/FNQavJWb9hJxE4rO3d/GhqH+yp/eIxSf 8YBfN3K/HKxIvdZSPGivZ8TufloTAIKlMfeJpMIl8eUJp5dynjXFgf8HC+9b6UVnMWx4 EfjbRFDowcl4QZHGhdExR/wbRP9S3/XmYf6CVKGusBUzMjwfM15pOg6YF0Aif1tpYIr6 yZjg== X-Gm-Message-State: AOAM5316V91CBB58GGI5FDzyIJ0aaPwE4Ne71KfvwXbSxT9zoYB/hdwz 2Vb10xPHMFkekLmTlTTe6/E= X-Google-Smtp-Source: ABdhPJz4DIhd0l2pGBdIa0TYCyQxfuQxH8NudN5plJWqxyLOjhoKSy0YzkrUL/vVAJDCBttb0WEhDA== X-Received: by 2002:a1c:f405:: with SMTP id z5mr9093800wma.72.1631560928566; Mon, 13 Sep 2021 12:22:08 -0700 (PDT) Received: from aspire-5942 (p200300d86724bd0078b61da375af17e5.dip0.t-ipconnect.de. [2003:d8:6724:bd00:78b6:1da3:75af:17e5]) by smtp.gmail.com with ESMTPSA id x11sm7791516wmk.21.2021.09.13.12.22.07 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Sep 2021 12:22:07 -0700 (PDT) From: Marco Wahl To: "Victor A. Stoichita" Subject: Re: behavior of (org-insert-heading-respect-content) References: <87lf4594t3.fsf@svictor.net> <87y285vats.fsf@gmail.com> <87ilz98s5a.fsf@svictor.net> Date: Mon, 13 Sep 2021 21:21:48 +0200 Message-ID: <875yv4uvqr.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=marcowahlsoft@gmail.com; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, 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=1631561009; 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: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=zGq98KVq0kpq3+y0vJKov2nuN5MPY/6QQttyVWsqpFc=; b=oQnjNrzaU8xeCFjr7iCsgycf3utuz67m9YlnVeaCPhAkJQUeRRdt8egR8y/jwfJrRoF4M/ SbzhcG04cAeNdLz+J/WenMjtqfyaMy/A/id3pJ4U/jtQj4vX9iXI3fmQIAAKtBnEBp8fie wz89WZIR8LFGzLC7pAcBIXhT1p5won4LmtL8W0PHCDyY99MTdSfq1nyS6WtoAfRzIc6Vp+ 6UkPBRC877gkxQVc8EdbHO12FQ7YUVYBf3V27r+ojKCzNApeBnCluUoAWStpKQQAxvVHa5 mSu11qHYwYZoXS3CovjvmYPBmabJqrHRYqY0wd4Y39Ck3MWKJbes/T1NaWj63Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1631561009; a=rsa-sha256; cv=none; b=AiHPBhptyJXTKjC1ZLWBdIrdfeaC3dBcivxPy9T7C+5WYe7+fHl4ontcEqQ81XIZ363sk3 vaLZMG8N8aSH8Y2RI6lggpU5rbvokXTpdAoARxYc4siy/Bl5q3SLgv55B9WVu2Z8YjDhJs s7JIgq1UfZIbmU/Hnx79uqNdMgNHN5eEesNg6JGq2Pq9I0tFThy0RoS4fbK4EAxalLLsuc 0Zz+5ehHSHmbarO20cggRLKskQK2t0phoE/2NNjELvrMBe1p6Dv6rgt+W/IhIeflZNRbcF HlFvxSeOc28DHYU7BcByTxheL6JVA+seSXh3QK9L4XOnpdeEUw6uEGmnpLclnQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=jqB04Bf3; dmarc=pass (policy=none) header.from=gmail.com; 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: -3.10 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=jqB04Bf3; dmarc=pass (policy=none) header.from=gmail.com; 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: 6E15D2A31A X-Spam-Score: -3.10 X-Migadu-Scanner: scn1.migadu.com X-TUID: 2Tr7lWat/FHl Hi Victor, > 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 > expected even when point is not in a subtree. It seems to only fail if > point is on the 1st line. As far is I see it, the intended behavior of org-insert-heading-respect-content with point before the first heading is to - insert the new heading immediately before the first heading. Respect the content! - If there is no heading at all in the file the heading shall be inserted at the bottom of the file. Do we agree on the desired behavior of org-insert-heading-respect-content? With your proposition the respect for the content gets lost, doesn't it? Ciao!