From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.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 CGdqDWrSp2XiqAAAe85BDQ:P1 (envelope-from ) for ; Wed, 17 Jan 2024 14:13:14 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id CGdqDWrSp2XiqAAAe85BDQ (envelope-from ) for ; Wed, 17 Jan 2024 14:13:14 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; none 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 27A8514110 for ; Wed, 17 Jan 2024 14:13:14 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQ5il-0001Pd-Pd; Wed, 17 Jan 2024 08:12:43 -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 1rQ5ij-0001PS-Om for emacs-orgmode@gnu.org; Wed, 17 Jan 2024 08:12:41 -0500 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQ5ih-00009I-MJ for emacs-orgmode@gnu.org; Wed, 17 Jan 2024 08:12:41 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 69923240101 for ; Wed, 17 Jan 2024 14:12:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1705497156; bh=5CctZolg5jpTM/eVVa2m+3K6Cs30kc7NkL3DLcfD4f8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=N8T9wJ/GP8ELD6PE9wtj1tu3Ae89x/EOQ0tMv09amAiKNeFsOVpmpoNoDTsFM9lgw KYWM9YQyxfm8vZbrq83BzF5c1CZg0tIqZVYvFk4O/KfrP+WgfiHQu4Prlv7gACpBCf /L6qtcKI3br5ruBLmHDYLg/H6GT8IToVVUb5ee4ahT6u8yf0AYdWEosviDbrQjvmbT MtuB6gFCnGo0hFYvgWYSM4i0bi9f7qoNChmJe3Gw3helIgETp8KIDSLlgAoUC0fOpd dDY/jm68Xu6CpFoocTD8DjVJZ3wuyZeTOTZZHlQY6H+2B2eML1+kJSYC2l8HpthOzP X351223s7n2KQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TFRBC27jcz9rxK; Wed, 17 Jan 2024 14:12:35 +0100 (CET) From: Ihor Radchenko To: Joseph Turner Cc: emacs-orgmode@gnu.org, Adam Porter Subject: Re: Should org-link-parser add type "file" when link has no "file:" prefix? In-Reply-To: <87mst5f1o9.fsf@ushin.org> References: <87o7e9ei3p.fsf@ushin.org> <87wmsx3vyc.fsf@localhost> <87a5pro14q.fsf@ushin.org> <87le9a76mk.fsf@localhost> <87wmss1r51.fsf@ushin.org> <87ttnvan3m.fsf@localhost> <87v87v0zno.fsf@ushin.org> <87le8pl7lw.fsf@localhost> <87mst5f1o9.fsf@ushin.org> Date: Wed, 17 Jan 2024 13:15:49 +0000 Message-ID: <87ttnchzi2.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.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-Migadu-Spam-Score: -4.00 X-Spam-Score: -4.00 X-Migadu-Queue-Id: 27A8514110 X-Migadu-Scanner: mx12.migadu.com X-TUID: /rlrK4lvK14N Joseph Turner writes: >> May you please provide an example with an Org file containing file links >> and how you envision to transform them? Will they be transformed >> depending on the directory the Org file is located in? > > I don't want to transform the file links. The idea is that an Org file > "foo.org" could be copied into a hyperdrive, and [[./bar.org]] would > point to a file called "bar.org" in the same folder in the hyperdrive. > > That way, you could copy both "foo.org" and "bar.org" from your local > directory into a hyperdrive, the links between them would work as-is. > > Pseudo-code for a hyperdrive.el :follow function for file: links: > > (defun hyperdrive--org-file-link-follow (url &optional _prefix _link) > (when hyperdrive-mode > (hyperdrive-open > (hyperdrive-convert-path-to-hyper-url url option)) ;; Turns "/foo" into "hyper://PUBLIC-KEY/foo" > t)) > > (org-link-set-parameters "file" :follow #'hyperdrive--org-file-link-follow) You do not really need Org mode to do this. Instead, it may be sufficient to define a file handler in order to make things work "magically". Check out 26.12 Making Certain File Names "Magic" section of Elisp manual. >> What we can do then is pass an extra argument to :follow function - the >> link object. That way, :follow function can get all the information it >> needs. > > I like this idea! Would this change break existing :follow functions > which only expect max two args? No. We can preserve backwards-compatibility by checking :follow function arity and only passing the extra argument with the :follow function supports that many arguments. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at