From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id xOtYE5aAtF5nQAAA0tVLHw (envelope-from ) for ; Thu, 07 May 2020 21:41:42 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id gIyAJ6KAtF6XJAAAbx9fmQ (envelope-from ) for ; Thu, 07 May 2020 21:41:54 +0000 Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:470:142::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 01A38940C62 for ; Thu, 7 May 2020 21:41:49 +0000 (UTC) Received: from localhost ([::1]:35908 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWoH6-0001P8-Hl for larch@yhetil.org; Thu, 07 May 2020 17:41:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33712) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWoGi-0001Ok-IZ for emacs-orgmode@gnu.org; Thu, 07 May 2020 17:41:24 -0400 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:41847) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWoGg-0007x4-Vb for emacs-orgmode@gnu.org; Thu, 07 May 2020 17:41:24 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id EF4C6C18; Thu, 7 May 2020 17:41:19 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 07 May 2020 17:41:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=imapmail.org; h= from:to:subject:in-reply-to:date:message-id:mime-version :content-type; s=fm3; bh=NeoDW/PnfKI41rOJvXmEs612DOu+WcZOUm0aVsK exqY=; b=RC6IvMxVjvb4LIzVOSlCzxvcztve04SzdoI9uOIWlPRZYQOi2GLK3XU f68ag+TB1ugDl6LTZcuOP/z5fV3v/AnFTHFdSbUjgIV8iBfKOXJv3PRjBDioH6Y4 Ho+chiSPL5nDa4LM12ICaOH/rfR9zuJZYtsKWsdfOFozaOchyHKZ4fnMB10u+/if scOwaKzBayZsBqFMNnUQE+Unk9hnggv2zAEe2b3q/WrmDqd8YUnzc6spTXb+pbBZ y7lCHWnGq90x4HEXheMBVWTNWQhIbHkIX9QO5n9jAW19ICwKKaE53gzu8Zh1zGJ1 Jz1xygnbfrRoIIH0asVryy5NG/fJ58w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=NeoDW/PnfKI41rOJv XmEs612DOu+WcZOUm0aVsKexqY=; b=o8ZbeMiqFaz4TVt5XKagB/yXc8TtVQltm tEBdQwTTSPHmWZ6jPR77zWtNK1lHoSc+EX3Lba2AHGNPS+dEPrfHSito53RjqNov 3kSEhyz7VR94AQzeuAtOpPJhAL/oMw2lpG7AlTDMkZK1kHpjXADtom4h0DgfSKI9 z+JoDorHHHKDD6IQElWE9owPATaW+uvCNCsWAUYkd3AspMIx1Hj3WD5JtJXZGuBQ tnA4J4giq1vuLvE/KqTdIXgAdHmf0qs4FTnP1XjpKLzYdIimS2CGAeryCMFCs2jz wOB36X4on2x41uY+ONvvBzeP9qul/Nh5PtbkqEQoLXJG4c7snaBmg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrkeduucetufdoteggodetrfdotffvucfrrh hofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgenuceurghi lhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurh ephffvufgjfffkgggtsehmtderredttdejnecuhfhrohhmpeforghtthhhvgifucfnuhhn ughinhcuoehmughlsehimhgrphhmrghilhdrohhrgheqnecuggftrfgrthhtvghrnhepvd fhffeihfelheeuheetuedutdfgueejffetgfekgfehgeetteefkefhvedvffetnecukfhp peejiedrudeirddufeehrdduudelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrg hmpehmrghilhhfrhhomhepmhgulhesihhmrghpmhgrihhlrdhorhhg X-ME-Proxy: Received: from localhost (c-76-16-135-119.hsd1.il.comcast.net [76.16.135.119]) by mail.messagingengine.com (Postfix) with ESMTPA id 0582530661CF; Thu, 7 May 2020 17:41:18 -0400 (EDT) From: Matthew Lundin To: Gustav =?utf-8?Q?Wikstr=C3=B6m?= , Org Mode List Subject: RE: [Bug] org-store-link should not insert a document level ID property In-Reply-To: Date: Thu, 07 May 2020 16:41:18 -0500 Message-ID: <87k11nifsx.fsf@fastmail.fm> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=64.147.123.24; envelope-from=mdl@imapmail.org; helo=wout1-smtp.messagingengine.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/07 17:41:20 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 X-Spam-Score: -1.71 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=imapmail.org header.s=fm3 header.b=RC6IvMxV; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=o8ZbeMiq; dmarc=pass (policy=none) header.from=imapmail.org; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 2001:470:142::17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Scan-Result: default: False [-1.71 / 13.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; GENERIC_REPUTATION(0.00)[-0.49833434727655]; DWL_DNSWL_BLOCKED(0.00)[imapmail.org:dkim,2001:470:142::17:from]; R_SPF_ALLOW(-0.20)[+ip6:2001:470:142::/48:c]; FREEMAIL_FROM(0.00)[imapmail.org]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.10), country: US(-0.00), ip: 2001:470:142::17(-0.50)]; TO_DN_ALL(0.00)[]; MX_GOOD(-0.50)[cached: eggs.gnu.org]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[imapmail.org,none]; DKIM_TRACE(0.00)[imapmail.org:+,messagingengine.com:+]; MAILLIST(-0.20)[mailman]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[76.16.135.119:received]; RCVD_IN_DNSWL_FAIL(0.00)[2001:470:142::17:server fail]; MIME_TRACE(0.00)[0:+,1:+,2:+]; ASN(0.00)[asn:22989, ipnet:2001:470:142::/48, country:US]; RCVD_TLS_LAST(0.00)[]; TAGGED_FROM(0.00)[larch=yhetil.org]; FROM_NEQ_ENVFROM(0.00)[mdl@imapmail.org,emacs-orgmode-bounces@gnu.org]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[imapmail.org:s=fm3,messagingengine.com:s=fm2]; URIBL_BLOCKED(0.00)[imapmail.org:dkim,whil.se:email,messagingengine.com:dkim]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain,text/x-patch]; HAS_LIST_UNSUB(-0.01)[]; RCVD_COUNT_SEVEN(0.00)[7]; FORGED_SENDER_MAILLIST(0.00)[] X-TUID: udMQgvZO4gvu --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Gustav Wikstr=C3=B6m writes: > Hi again, > > Patch is attached. It's not applied yet as it doesn't include anything > about user-configuration yet. @Matt Lundin, care to elaborate what you > had in mind in terms of that? > > With this patch a link before first headline is stored with the > filename (no path) as description. Following the link does what you'd > expect. Tests ran fine with the patch applied. Hi Gustav, Sorry it's taken so long to get back to you. Thanks for applying this. It makes the behavior consistent. What I was thinking of in terms of configuration is being able to preserve path-based links (instead of IDs) if creating a link above the first headline. This is the behavior that existed in the past when org-id-link-to-org-use-id was set to t or 'create-if-interactive-and-no-custom-id. I've attached a patch that implements this. However, I also know that we are trying to avoid configuration/feature creep in Org, so I'm submitting this here for comments. Is this a configuration other people want? If not, it would be easy enough for me to hack this through advice-add. Best, Matt --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Allow-configuration-of-whether-to-create-IDs-before-.patch >From 758c7c513c6e5e0457b483dcf2bf7c9299d1015b Mon Sep 17 00:00:00 2001 From: Matt Lundin Date: Thu, 7 May 2020 16:31:05 -0500 Subject: [PATCH 1/1] Allow configuration of whether to create IDs before first heading This allows users to keep file (path-based) links above the first heading of a file. * lisp/ol.el: (org-store-link) New test for whether to use ID links * lisp/org-id.el: (org-id-create-id-before-first-heading) New variable --- lisp/ol.el | 5 ++++- lisp/org-id.el | 11 +++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lisp/ol.el b/lisp/ol.el index 0cb1b0a7e..d072ad9f1 100644 --- a/lisp/ol.el +++ b/lisp/ol.el @@ -35,6 +35,7 @@ (defvar org-comment-string) (defvar org-highlight-links) (defvar org-id-link-to-org-use-id) +(defvar org-id-create-id-before-first-heading) (defvar org-inhibit-startup) (defvar org-outline-regexp-bol) (defvar org-src-source-file-name) @@ -1619,7 +1620,9 @@ non-nil." (and (eq org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id) (not custom-id)))) - (and org-id-link-to-org-use-id (org-entry-get nil "ID")))) + (and org-id-link-to-org-use-id (org-entry-get nil "ID"))) + (or (not (org-before-first-heading-p)) + org-id-create-id-before-first-heading)) ;; Store a link using the ID at point (setq link (condition-case nil (prog1 (org-id-store-link) diff --git a/lisp/org-id.el b/lisp/org-id.el index 34720b7f2..8792aa3cb 100644 --- a/lisp/org-id.el +++ b/lisp/org-id.el @@ -123,6 +123,17 @@ nil Never use an ID to make a link, instead link using a text search for (const :tag "Only use existing" use-existing) (const :tag "Do not use ID to create link" nil))) +(defcustom org-id-create-id-before-first-heading t + "Non-nil means storing a link before the first heading will use IDs. +This determines how `org-store-link' generates links before the +first heading in an Org file when `org-id-link-to-org-use-id' is +configured to create IDs. + +When nil, `org-store-link' will create a normal file link instead +of an ID if before the first heading." + :group 'org-id + :type 'boolean) + (defcustom org-id-uuid-program "uuidgen" "The uuidgen program." :group 'org-id -- 2.26.2 --=-=-=--