From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:1008:1e59::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id jKnsCx1OjmVlYgEAkFu2QA (envelope-from ) for ; Fri, 29 Dec 2023 05:42:05 +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 aAkqBR1OjmVndgAA62LTzQ (envelope-from ) for ; Fri, 29 Dec 2023 05:42:05 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=ushin.org header.s=key1 header.b=GSAdyI8b; 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=quarantine) header.from=ushin.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1703824925; 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:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=CBh4bgA6ewfK2rCckVDtLyYl6M/cfoAfOOSJRxzTQ4M=; b=CPENkOv570BUyeGfkGIdCD9W02WREWsJX4JDlbWWZ+63BySETfFu308Ej7QTwwl5crJiZ8 /pzcajnC79fJdZGWYJbSej5k6FOcQIMG1ECpNURbARObp/WXq755E9/EzM1nl5dSUqZtZH 8oNbXa1vvSMtQJ8iwiv/SPwd0UIcJMTtn63AYUEvXkkctNw4ZzYopJLYAum7BwB26Wol5g xmytrLPU5J3Ju5g1lx2rpXEolgtYSApYdRDESo5yqVZi39YFdpkL0JSm7mNPVIQEPh3Olo jG0m4Hsy7N35nP4ByCODBvyQW+mME34FMONDFaTmJiyr5nfZ1S7SdHOibi+gAQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1703824925; a=rsa-sha256; cv=none; b=C9bJ4RmjekikU3BNUPkflGYPcEAKLx+9BX5JbZmPezE1lrwaVqWGprZjDrHgkJpVrAtno2 JnwufnSVAvjKnEXICbiHZPiDrneizSdD10l8qPus5CBR9mfHhszGi0SUmr8HiolCR012cu nypVHZtPwePVudLakFp52CS5iwiQPw0RuAcqfn9462A1KbgWm6dtEwr6vowcuHAhiLqP2/ wF7PMKFmauFUJgjH8D2YdXw1hsSdMU3i/CrLuzQekQWKBTXQEObSsYX/yjplO4Vfb4lCDZ plKSiwkcJHFsPma9p9HnAIU4u5bnFV0/Co9K+4PxWcI/43C5Zu9QWdSeuRFJkw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=ushin.org header.s=key1 header.b=GSAdyI8b; 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=quarantine) header.from=ushin.org 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 B0E0C1E1E7 for ; Fri, 29 Dec 2023 05:42:04 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rJ4gR-0008KC-R6; Thu, 28 Dec 2023 23:41:19 -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 1rJ4gP-0008Jj-FX for emacs-orgmode@gnu.org; Thu, 28 Dec 2023 23:41:17 -0500 Received: from out-186.mta1.migadu.com ([95.215.58.186]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rJ4gH-0006W8-Sf for emacs-orgmode@gnu.org; Thu, 28 Dec 2023 23:41:17 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ushin.org; s=key1; t=1703824862; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=CBh4bgA6ewfK2rCckVDtLyYl6M/cfoAfOOSJRxzTQ4M=; b=GSAdyI8bQyQPX/xe1mABymIHRmH1W5Qf3mTD/xCIjsUhADvHLNlRsbIRtTnjz92PSut4E5 hKYCBlQk97EPZjaoApeQKLbVi9IFqKCYdnKxFpuE8QMdMdP9Zz7/E2vKYe/XLdw9923qp7 47O+BbxR7I+wu8Z9WkzbfcK5c9gOXBBmuAnYrAZopwgF09TFXLrfhsLfrd9PcoMFiRfPuC Mi4A0GCPgfyPXpyT58kEhjWmziDwjEHUZT75fAvYls+yxzljUJacpvQu3eNG0WeEIasSzk UezN4p4v7BAcKK4UQa5VXBoup7MUYq0cXEmik9JiCZ27ywGiCnUM8HpiwmYIeA== From: Joseph Turner To: emacs-orgmode@gnu.org Cc: Adam Porter Subject: Should org-link-parser add type "file" when link has no "file:" prefix? Date: Thu, 28 Dec 2023 20:12:29 -0800 Message-ID: <87o7e9ei3p.fsf@ushin.org> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=95.215.58.186; envelope-from=joseph@ushin.org; helo=out-186.mta1.migadu.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, 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: -6.18 X-Spam-Score: -6.18 X-Migadu-Queue-Id: B0E0C1E1E7 X-Migadu-Scanner: mx12.migadu.com X-TUID: a1HsZf0GX3iZ Hello! I expect the following to return "[[/foobar]]": (with-temp-buffer (delay-mode-hooks (org-mode)) (insert "[[/foobar]]") (goto-char (point-min)) (let ((link (org-element-link-parser))) (org-element-link-interpreter link nil))) Instead, it returns "[[file:/foobar]]". In hyperdrive.el currently, "[[/foobar]]" and "[[file:/foobar]]" have different meanings: a link with no protocol prefix, like "[[/foobar]]", points to a file inside of the same hyperdrive (virtual p2p folder), whereas a link with the "file" protocol prefix, like "[[file:/foobar]]", points to a file on the local filesystem: https://git.sr.ht/~ushin/hyperdrive.el/tree/33d8cef0507fbbe25839a019b5c42fda862ac4de/item/hyperdrive-org.el#L137 In org-transclusion.el, org-element-context is used to parse a link, and then org-element-link-interpreter is used to insert it into a buffer: https://github.com/nobiot/org-transclusion/blob/b10d4de93c6c0523bd4e7e72c11ef3a9a5630370/org-transclusion.el#L372 The problem is that the "file" protocol prefix is added to links which have no protocol prefix. When you call org-transclusion-make-from-link with point on "[[/foobar]]", org-transclusion.el ends up inserting this: #+transclude: [[file:/foobar]] which, at least with hyperdrive.el, doesn't point to the same file as #+transclude: [[/foobar]] All suggestions are welcome! Thank you!!! Joseph