From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id 6LUKKlzQxGXFuAAA62LTzQ:P1 (envelope-from ) for ; Thu, 08 Feb 2024 14:00:12 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id 6LUKKlzQxGXFuAAA62LTzQ (envelope-from ) for ; Thu, 08 Feb 2024 14:00:12 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=EvPW03Ie; dmarc=pass (policy=none) header.from=posteo.net; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1707397212; 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=6PEdkHEDLT2RyCH3g8Kggq/bx8LWJbs6gI+N3vsd0SU=; b=C+TxQtgSW8YrXbKS/bXbTRjiBBkUUKBXDZdfJEv7cKFiCUHJqPTYcmCXIwyVNdkK4D9Dml IKSV12wTn9Ancr3wfyLffyCiZUHzoVyv7PpZysUGib+uLBy2k7OhR9RLXfXdlpfxkBvF4h Z2ehMFzMF8RBwuGO+qZ0VPjGCF9dzJxy/2TSzlsT6yWNm0udGMVG0F03RzDBAMBLfsfczy g+NNp9QdZv1TppBiFbuUDwBq/dhRRkkNODvkvQUdLKhF1MUrM+zh4+A8sdknCVFfksMXkE M8tTfxSJq4nXsiqgcPloct0egTMx3nwBmtixIkl+IPskN9QrM3QSBImpiHAV2Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=EvPW03Ie; dmarc=pass (policy=none) header.from=posteo.net; 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1707397212; a=rsa-sha256; cv=none; b=Xq2PBI+MpqE6yYS90wONyejX2G5qhTFBNJnwKw/TIYoHnGy9Xj6D8OII6vzcE6VpsZtxxU zeLrN3shQIlCtIYLqwhBaZ1DSiUFJZb/99t0jlUAToZ5kp3kjhiyqxFhzhyusJ4v3nwa2N kGGLdiD/ZpLNatUH1sI+zpQPkAm7Dul2RWXnDp6Nz36Cq7mPQf4wAFgTe6xygnrn46fbrs FbhWo7fce/0v3obrIUREPLNLuAx5DS3iojlJb1RVa1Z6rUuIopoxN38IEqlVIY05/r6tjU 9KD33t8b3PXlZyvI/FzOSpvWjpYukRP3e+uHxRahjyVQp7NGkWQt7muFQJSLgQ== 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 1F56D167C5 for ; Thu, 8 Feb 2024 14:00:12 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rY3zv-0004hn-4W; Thu, 08 Feb 2024 07:59:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rY3zt-0004hY-CU for emacs-orgmode@gnu.org; Thu, 08 Feb 2024 07:59:21 -0500 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rY3zq-0004iP-Tu for emacs-orgmode@gnu.org; Thu, 08 Feb 2024 07:59:21 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 83A4024002A for ; Thu, 8 Feb 2024 13:59:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1707397155; bh=SUEfrtMxrXzkfUpCf6IOOlslTKMRxIvq8+CRJxDuQlI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=EvPW03IerGHAQ/glo0CxGLVkvL8mmQMVHxlYcYM3K0CzpH3G+bzxfN40LOx5X2wX8 B5Xm82axV/ylKdU7E9Ajb37ICXqAGtBAFcaguCeMB1Z0FCLdJR6wI7t57i0JB28Iac MbcftqW5mJ2OaGDsSqfdDGV7x3ElQuWu8s2mWgMu0T0B5K6Bu/fEYzTgjN2Z3jZGAP j6QREQbayT6VJ0AD/+/vA83znPhV4mvVI4QNQ19Rm3ykUK5zU32yybSgXJh82ERF4O lggHLMHjRL9LyAOVm5IQyB9ZLWzXtQF5IjIrPKbQWcnWybmjiCFmquMROBROzIwcLw FO1eSoKBMrukw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TVxrf3dn9z9rxK; Thu, 8 Feb 2024 13:59:14 +0100 (CET) From: Ihor Radchenko To: Rick Lupton Cc: "Y. E." Subject: Re: [PATCH v2] org-id: allow using parent's existing id in links to headlines In-Reply-To: <2a4b236c-c377-4493-b5ed-632c5518d514@app.fastmail.com> References: <118435e8-0b20-46fd-af6a-88de8e19fac6@app.fastmail.com> <87edkwsafe.fsf@localhost> <87cywh2ad6.fsf@localhost> <87jzpmqiy0.fsf@localhost> <2cdfefbf-e9e3-4aeb-a410-1ff3a9d6168e@app.fastmail.com> <87zfybzkul.fsf@localhost> <3c5737c8-f489-4144-a27f-c0e0527c79c0@app.fastmail.com> <87bkaqcjpz.fsf@localhost> <87msu7r902.fsf@localhost> <1b50d1a4-8573-4dcc-9427-8970f67e632a@app.fastmail.com> <87r0i0mgzi.fsf@localhost> <70c0e6fb-3e9f-4b84-8d00-1b1e62ec19d0@app.fastmail.com> <87cytdithi.fsf@localhost> <2a4b236c-c377-4493-b5ed-632c5518d514@app.fastmail.com> Date: Thu, 08 Feb 2024 13:02:42 +0000 Message-ID: <87wmrfw1l9.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -9.89 X-Spam-Score: -9.89 X-Migadu-Queue-Id: 1F56D167C5 X-Migadu-Scanner: mx12.migadu.com X-TUID: jB64zs75/FJD --=-=-= Content-Type: text/plain "Rick Lupton" writes: >> It looks like we cannot simply rely on narrowing to determine the >> created heading level. > > I think you're right. I have extended `org-link-search' to accept an optional argument describing the org element where newly created headings should go as subheadings. > > My thought was that this was not significantly more complicated than just passing the numeric level for new headings, but actually more flexible (e.g. you could if you wanted (with additional future elisp) create missing headings as part of a "To be filed" subtree within the file, rather than always at the end). > > Does that look ok? Yes. > [is it useful to keep attaching the unchanged first patch so they are available as a set?] Yes, it is useful. Makes it easier for my to batch-apply the patchset using https://git.kyleam.com/piem/about/ I have some thoughts about rewording your changes to the manual and ORG-NEWS. See the attached patch on top of yours. > Subject: [PATCH 1/2] lisp/org.el (org-insert-heading): allow specifying > heading level *Allow > * lisp/org.el (org-insert-heading): Change optional argument TOP to > LEVEL, accepting a number to force a specific heading level. > * testing/lisp/test-org.el (test-org/insert-heading): Add tests > * etc/ORG-NEWS: Document changes Please end sentences with period. > From d5759dd95bec88be38ddbde07fa4437c0528469a Mon Sep 17 00:00:00 2001 > From: Rick Lupton > Date: Sun, 19 Nov 2023 14:52:05 +0000 > Subject: [PATCH 2/2] org-id.el: Add search strings, inherit parent IDs > > ... > (org-link-try-link-store-functions): Extract logic to call external > link store functions. Pass them a new `interactive?' argument. > ... > (org-id-store-link): Consider IDs of parent headings as link targets > when current heading has no ID and `org-id-link-consider-parent-id' is > set. Add a search string to the link when enabled. Please, use two spaces between sentences. > * lisp/org-lint.el: add checker for "::" in ID properties. ... and start sentences from capital letter: *Add > -(defun org-link-search (s &optional avoid-pos stealth) > +(defun org-link-search (s &optional avoid-pos stealth new-heading-container) The new optional argument to a public function should be announced in ORG-NEWS. > + (new-heading-level (if new-heading-container > + (+ 1 (org-element-property :level new-heading-container)) What if new-heading-container is not a heading? > + 1))) > + (goto-char new-heading-position) This is err when container ends after narrowed region boundary. > +(defun org-link-precise-link-target () > ... > + (cond > + (name > + (list name > + name > + (org-element-begin element))) It would make sense to use #+caption as default description when available. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Amendments-to-org-manual.org-and-ORG-NEWS.patch >From 0f9a4503d95f7682229ae1c1ad8a4e2d069fc644 Mon Sep 17 00:00:00 2001 Message-ID: <0f9a4503d95f7682229ae1c1ad8a4e2d069fc644.1707396844.git.yantar92@posteo.net> From: Ihor Radchenko Date: Thu, 8 Feb 2024 13:53:44 +0100 Subject: [PATCH] Amendments to org-manual.org and ORG-NEWS --- doc/org-manual.org | 18 ++++++++++-------- etc/ORG-NEWS | 27 ++++++++++++++------------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index 49fce9113..e933a2d63 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -3489,14 +3489,16 @@ ** Handling Links #+vindex: org-id-link-consider-parent-id #+vindex: org-id-link-use-context - When ~org-id-link-consider-parent-id~ is ~t~ (and - ~org-link-context-for-files~ and ~org-id-link-use-context~ are both - enabled), parent =ID= properties are considered. This allows - linking to specific targets, named blocks, or headlines (which may - not have a globally unique =ID= themselves) within the context of a - parent headline or file which does. - - For example, given this org file with those variables set: + #+vindex: org-link-context-for-files + When ~org-id-link-consider-parent-id~ is ~t~[fn:: Also, + ~org-link-context-for-files~ and ~org-id-link-use-context~ should be + both enabled (which they are, by default).], parent =ID= properties + are considered. This allows linking to specific targets, named + blocks, or headlines (which may not have a globally unique =ID= + themselves) within the context of a parent headline or file which + does. + + For example, given this org file: #+begin_src org ,* Parent diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 84bbc5243..e29d2895f 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -477,22 +477,23 @@ The change is breaking when ~org-use-property-inheritance~ is set to ~t~. The =TEST= parameter is better served by Emacs debugging tools. -*** ~org-id-store-link~ now adds search strings for precise link targets +*** =id:= links support search options; ~org-id-store-link~ adds search option by default -This new behaviour can be disabled generally by setting -~org-id-link-use-context~ to ~nil~, or the setting can be toggled for -a single call to ~org-store-link~ with a universal argument. +Adding search option by ~org-id-store-link~ can be disabled by setting +~org-id-link-use-context~ to ~nil~, or toggled for a single call by +passing universal argument. When using this feature, IDs should not include =::=, which is used in links to indicate the start of the search string. For backwards compability, existing IDs including =::= will still be matched (but -cannot be used together with precise link targets). An org-lint -checker has been added to warn about this. +cannot be used together with search option). A new org-lint checker +has been added to warn about this. *** ~org-store-link~ behaviour storing additional =CUSTOM_ID= links has changed -As well as an =id:= link, ~org-store-link~ stores an additional "human -readable" link using a node's =CUSTOM_ID= property, if available. +Previously, when storing =id:= link, ~org-store-link~ stored an +additional "human readable" link using a node's =CUSTOM_ID= property. + This behaviour has been expanded to store an additional =CUSTOM_ID= link when storing any type of external link type in an Org file, not just =id:= links. @@ -778,11 +779,11 @@ For =id:= links, when this option is enabled, ~org-store-link~ will look for ids from parent/ancestor headlines, if the current headline does not have an id. -Combined with the new ability for =id:= links to use search strings -for precise link targets (when =org-id-link-use-context= is =t=, which -is the default), this allows linking to specific headlines without -requiring every headline to have an id property, as long as the -headline is unique within a subtree that does have an id property. +Combined with the new ability for =id:= links to use search options + [fn:: when =org-id-link-use-context= is =t=, which is the default], +this allows linking to specific headlines without requiring every +headline to have an id property, as long as the headline is unique +within a subtree that does have an id property. For example, given this org file: -- 2.43.0 --=-=-= Content-Type: text/plain -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at --=-=-=--