From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id 6HvBG2h9v2QeUwEASxT56A (envelope-from ) for ; Tue, 25 Jul 2023 09:44:40 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id SJ6PG2h9v2TeBAAAauVa8A (envelope-from ) for ; Tue, 25 Jul 2023 09:44:40 +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 C96415D3E2 for ; Tue, 25 Jul 2023 09:44:38 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Vv46p3DJ; 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"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1690271079; 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=kGrsOQdD+7C/o+2hduIns+7Na7O/Ty+xT/v+fWjrzyo=; b=UzkjppxPfWKV/ir/YDUs0/GXBwFcZQvxsPpIRBeTwuuVARyirxHkeuLIFKCQCE2jQTEgTk tALZCWSKxs3mcuZ3yLD3Gq8wqtHPmkz0GajUyKNuWyKDXmCSCKYm0c7i/4gDh17QDEYkZE gYTpO6U2zysZducOi8JXsGjPbZ2KjIqQ+reUT0QZwccbd4+DjKwLnncq8z/sMGEHF1a2bH HX3q0TutdORTpz+4+XvGyRgQ+3CzOPyrMqmsN0v0KT8kppMuTH3a2zd1mXXulvLQkNcjri qooLWP461n+k/1U7iKPTpZKbOjbAh79xhBDWbVs4fy2JMR2jBaJbi7WFEHnkjg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Vv46p3DJ; 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"; dmarc=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1690271079; a=rsa-sha256; cv=none; b=hkoV6CtMVTsmkjwhDY+/yErSZLBxGK/zkQlj3e2K8ecI+uzNwPyB5I+giIJnfXrmriMRLm NxqXkzSEJ97pcz+96yr9HkFoKvAZAn6N/P2duV6hr3TSOc/e+INg+WPrwFzNevuibYG3mt 0eu3frH0BFmvBmSMSu/HtGgJhmXY0M/LWoQmkTsuah7MlfQON7w/fQfO4/k46HAznBdr69 ybMofij7A+0IxrcEJHaABPdyihkwwgQ6u7l/Aw/0jJrSNCxS9EDH7M5uJMvLCHU+xlDO0a s3DBCgY7ABotoQNLSLfmxa9Ytbq5pT5quyciNCIfDIg1+X9eQf/ewIPp4z9exA== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOChp-0001qf-Id; Tue, 25 Jul 2023 03:43:41 -0400 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 1qOChn-0001qX-Mz for emacs-orgmode@gnu.org; Tue, 25 Jul 2023 03:43:39 -0400 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 1qOChl-0001Na-SX for emacs-orgmode@gnu.org; Tue, 25 Jul 2023 03:43:39 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 34E9B240027 for ; Tue, 25 Jul 2023 09:43:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1690271016; bh=Iij4x4jzlUx6SPcKgHo1rpte+LPR4x1wehyg0kov4Ew=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=Vv46p3DJYlIdQEFcvNmCMuJXgOAz6KtvgqKLJzcoz+96qolw/qk4O7w2dAnbWidZZ igd6N3JURVjGHnLVssTsko0/aEvmTJHQVQZcnCHuwsxmm9nWGgZXn/SAgyRN2RkyHk trmxMAkEMN21CPeCWy9mJd3QLuom7YPilra7MWqU06DI7CyBoPfaeNTkFXwPIINPh5 9/jppqH6xemk3phHW7Fo/vbumR3zqpNUOX7DtDhAa0hA027gnnXBfq56mSdOJ8RfRT FNoUa1MwV9+826lRKIFc+X0HxboEXZPQEfTYlGgueMpu/Pc4PYg+ijLB3OXSZkOU8m rIZu3/s4Iu0nA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4R98Cq3qQ9z6twd; Tue, 25 Jul 2023 09:43:35 +0200 (CEST) From: Ihor Radchenko To: Rick Lupton Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] org-id: allow using parent's existing id in links to headlines In-Reply-To: <118435e8-0b20-46fd-af6a-88de8e19fac6@app.fastmail.com> References: <118435e8-0b20-46fd-af6a-88de8e19fac6@app.fastmail.com> Date: Tue, 25 Jul 2023 07:43:49 +0000 Message-ID: <87edkwsafe.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain 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_H5=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-Spam-Score: -6.87 X-Migadu-Queue-Id: C96415D3E2 X-Migadu-Spam-Score: -6.87 X-Migadu-Scanner: mx0.migadu.com X-TUID: Z0WnxWLLzbo+ "Rick Lupton" writes: > Here is a small new feature for org-id that I have been using and finding useful. The patch adds the option to look for ancestors of the current headline that have an ID defined and use that together with a link search string to link to specific headlines, without needing every single headline to have its own ID. I think that it will be a reasonable addition. > Now, with `org-id-link-to-org-use-id' set to `inherit`, "H2" is not modified, and the resulting link is `[[id:abc::*H2][H2]]`, which will still take you to the same place as long as the sub-heading is unique within the parent heading with an ID. What about inherited CUSTOM_ID? > Feedback on the patch welcome. If you would like to merge this I will (I assume) need to sort out FSF copyright assignment and update ORG-NEWS and the manual. Yes, on both questions. See https://orgmode.org/worg/org-contribute.html#copyright > + ((and (featurep 'org-id) > + (eq org-id-link-to-org-use-id 'inherit)) What if none of the parents have an ID? > + ;; Store a link using the inherited ID and search string > + (setq cpltxt (condition-case nil > + (prog1 (org-id-store-link 'inherit) > ... > + "NONE")))))) This is code duplication from another branch of the same function. Please, rewrite without copy-pasting large chunks of code. For example, you can extract the common parts of the code into a private helper function. > ;;;###autoload > -(defun org-id-store-link () > +(defun org-id-store-link (&optional inherit) > "Store a link to the current entry, using its ID. > > +If INHERIT is non-nil, consider also parents' IDs if the current > +entry does not have an ID. > + This will no longer store a link to current entry with INHERIT argument. The search string will be missing from the link path. Ideally, we should have all the necessary logic to store the link within `org-id-store-link' and then use `org-link-set-parameters' to configure id links. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at