From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id wKgeLXnFumVG1wAAqHPOHw:P1 (envelope-from ) for ; Wed, 31 Jan 2024 23:11:05 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id wKgeLXnFumVG1wAAqHPOHw (envelope-from ) for ; Wed, 31 Jan 2024 23:11:05 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=ushin.org header.s=key1 header.b=vnmz91MA; 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=1706739065; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=nU3yrjHtoIPaC3UE6DyhrtO/GUdo3z2EAsdtOA7/020=; b=rYv/NnQWhJJ4Nd2BmnJ1ewqtW+IifkmDBIbbsggPjWOQnQd2H6rlhfQEXMeUmD3CMnENle VZ1CPvO/C99qBmHf1XcJTvHaOqdbcyLHtkJLMlunO2jMQ48e6enCAt/NC+uk1Y4wTMHY/Y 3mUHGrrYMXF/CwpH0pecdSV/4t8PlDR0m7iHewJxRxpVQm8dwIsF2NiLayTmsDhXtBtuSv O/7+271aHtScy9O4K56Wnh/gNMTknpp0UmKxYIBFEM6VZ0+NEUCYMd/VVt68iYei36SjYK W+2RiF1L2ROXYt0SwB+n6ILDl53xTnrQGVrv2ht41LDZYWF7iFWxK5yaKWYNRw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=ushin.org header.s=key1 header.b=vnmz91MA; 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-Seal: i=1; s=key1; d=yhetil.org; t=1706739065; a=rsa-sha256; cv=none; b=koM6qzi3uADvdM2T3uvA46G3z+xBk+bdWOoI7QvByRp5gjMOk+Ej71lYvLTO4t1iQ+wikU coSFxXKJBJEZjrOVCMHSOAzGDtC56x994ZPRWGRT+3nEpek39FJupwtA8N6dtK6p8ub9Ju GzpO+ZF5rmcu6bkQEA4WZyD/bzgbGPqHQSuA2/fUBdr7Au3jHOt3F8xPHNL6izagLiWhWh 6arRHumuZyiU6XGVAtxFMDuw9UQ06yGplDNPHfG6k+L+d/YfTZAGHjqgVHRtF1ydB1jxYV ksbghhHLUj6NIXsJNf3567KbgTxcYM8FdBXwk3VuS9lBLzhjQzc1F/gMBANXQQ== 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 A587B41D8B for ; Wed, 31 Jan 2024 23:11:03 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVImo-00041U-09; Wed, 31 Jan 2024 17:10:26 -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 1rVIml-0003yW-C2 for emacs-orgmode@gnu.org; Wed, 31 Jan 2024 17:10:24 -0500 Received: from out-182.mta1.migadu.com ([2001:41d0:203:375::b6]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVImi-0004IB-MJ for emacs-orgmode@gnu.org; Wed, 31 Jan 2024 17:10:22 -0500 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ushin.org; s=key1; t=1706739009; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nU3yrjHtoIPaC3UE6DyhrtO/GUdo3z2EAsdtOA7/020=; b=vnmz91MAfhorMKYmx6nKYXnmQSv5zcO/NFsuMK9p4YZkQLlbbTdRKBoVh5PW2wCV/7pR6S ZQlN62VJnqUJUj7S8FGRVaMhiVVCAEh9VbjKYF78K+9yflMTUvxzPnBmnOBHqx8bQpZytv 29I9dWGSrl4ClXsTHiYT1LYroJFSSdbrh1BBro0gBsKTfHMrfupH7Zei1wxmoJzV+iWiAu rX1VFF4AA92gESSPu/ga1CQlfLB0f0dT+ui4KNk+RyGGoaXMFax/U71Nd5mALpU1EX22O4 dM3lsUlRNdumUvfAthL1Uy5tdKcNYtHTLLbs0uu1gdEekNKZC5ymSNysEsCixg== Date: Wed, 31 Jan 2024 22:10:05 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: joseph@ushin.org Message-ID: TLS-Required: No Subject: Re: Should org-link-parser add type "file" when link has no "file:" prefix? To: "Ihor Radchenko" Cc: emacs-orgmode@gnu.org, "Adam Porter" In-Reply-To: <87ttnchzi2.fsf@localhost> 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> <87ttnchzi2.fsf@localhost> Received-SPF: pass client-ip=2001:41d0:203:375::b6; envelope-from=joseph@ushin.org; helo=out-182.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.86 X-Migadu-Scanner: mx13.migadu.com X-Spam-Score: -6.86 X-Migadu-Queue-Id: A587B41D8B X-TUID: OWPjOhSC6VtA January 17, 2024 at 5:15 AM, "Ihor Radchenko" wrote= : >=20 >=20Joseph Turner writes: >=20 >=20>=20 >=20> >=20 >=20> > May you please provide an example with an Org file containing fil= e links > > >=20 >=20> > and how you envision to transform them? Will they be transformed > > >=20 >=20> > depending on the directory the Org file is located in? > > >=20 >=20>=20 >=20> I don't want to transform the file links. The idea is that an Org = file > >=20 >=20> "foo.org" could be copied into a hyperdrive, and [[./bar.org]] wou= ld > >=20 >=20> point to a file called "bar.org" in the same folder in the hyperdr= ive. > >=20 >=20> That way, you could copy both "foo.org" and "bar.org" from your lo= cal > >=20 >=20> directory into a hyperdrive, the links between them would work as-= is. > >=20 >=20> Pseudo-code for a hyperdrive.el :follow function for file: links: > >=20 >=20> (defun hyperdrive--org-file-link-follow (url &optional _prefix _li= nk) > >=20 >=20> (when hyperdrive-mode > >=20 >=20> (hyperdrive-open > >=20 >=20> (hyperdrive-convert-path-to-hyper-url url option)) ;; Turns "/foo"= into "hyper://PUBLIC-KEY/foo" > >=20 >=20> t)) > >=20 >=20> (org-link-set-parameters "file" :follow #'hyperdrive--org-file-lin= k-follow) > >=20 >=20 > You do not really need Org mode to do this. Instead, it may be >=20 >=20sufficient to define a file handler in order to make things work >=20 >=20"magically". Check out 26.12 Making Certain File Names "Magic" sectio= n >=20 >=20of Elisp manual. Thank you! I've added a note to look into that: https://todo.sr.ht/~ushi= n/ushin/168#event-288786 > >=20 >=20> >=20 >=20> > What we can do then is pass an extra argument to :follow function= - the > > >=20 >=20> > link object. That way, :follow function can get all the informat= ion it > > >=20 >=20> > needs. > > >=20 >=20>=20 >=20> I like this idea! Would this change break existing :follow functio= ns > >=20 >=20> which only expect max two args? > >=20 >=20 > No. We can preserve backwards-compatibility by checking :follow functio= n >=20 >=20arity and only passing the extra argument with the :follow function >=20 >=20supports that many arguments. Good to know. If the goals of hyperdrive.el can be accomplished without = adding complexity to Org mode, it may be best to avoid avoid adding anoth= er argument to :follow functions. WDYT? > --=20 >=20 > Ihor Radchenko // yantar92, >=20 >=20Org mode contributor, >=20 >=20Learn more about Org mode at https://orgmode.o= rg/%3E . >=20 >=20Support Org development at , https://= liberapay.com/org-mode%3E,=20 >=20 > or support my work at https://liberapa= y.com/yantar92%3E >