From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:5f26::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id 8CCSOaOIkGV54QAAkFu2QA (envelope-from ) for ; Sat, 30 Dec 2023 22:16:20 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id CNvAM6OIkGVmcAAAqHPOHw (envelope-from ) for ; Sat, 30 Dec 2023 22:16:19 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=ushin.org header.s=key1 header.b=cG9xp7Is; 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=1703970979; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=I1txutDVS9GYQ2WAtdSG7BC3bOq5YQ4fD1K+HVASyHc=; b=mxQ/TjTNx23kdbmjR2r51A9AV8g4HUHGWTNZFeMnjbjcy7W7RN5SqXyovm5cE9MFGpl2uD 4YLHAfPNvOZvepsWKo+jTPkRFRNp/M+x5g3s9iDaQysKr/ukhekPbDrW/ZYm+eyvgrzAZ+ xMWIxLV3u30BVMElNSKw5KLsr/8Eb6sgxQz8TOmorZ3f2oWmmj16sgCSDykFIWWWz5vbym gwHEmERNvV7A8o5/lpSRacMRTyzbXwufhtgIlQDRVyVfNOQ1wfZPLgil6ZAB2wZxjIm+zh hXmPU3e9D1Yn6X+sujUaweF8ZGsA9d+2t9s91eewwX7Xesm8alsqtaw9/34Gnw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1703970979; a=rsa-sha256; cv=none; b=mEYd8KhsYvK1T5LL3DfccAsUBQjfs5HcKhgCkIRPN/Ao8EL1h76fiZttbkjS0nCgzFXc6X Jc6ug1Sl1wDSSYHEMZPbgPw5ysV+g8oKuxz78uJrHIJzvoTHnHP1LIYKjtHaJrZLyL+0QG JHi4mHWzxVGm6XxgO2Fp68xYnjQ2D8rH+d0bgzeQnW59L3uMvgxDP5HpOUtyjr7EGgY0YP TT4t6N1df1ZQ4tXoPnYnxFfoIR3S3BOR7EwuSxkaqUfNRZua0EgLOSCx8SnUqN238NhBnx G6FmFkU/LmMbWXxMvqBsEZKrVfcqhSPUvtuyoVvtWnbYc02MneQbbOE8KTmTvw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=ushin.org header.s=key1 header.b=cG9xp7Is; 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 6AC82579CE for ; Sat, 30 Dec 2023 22:16:18 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rJgfx-0000tR-48; Sat, 30 Dec 2023 16:15:21 -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 1rJgfu-0000t0-9y for emacs-orgmode@gnu.org; Sat, 30 Dec 2023 16:15:18 -0500 Received: from out-182.mta1.migadu.com ([95.215.58.182]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rJgfq-00054K-Cv for emacs-orgmode@gnu.org; Sat, 30 Dec 2023 16:15:17 -0500 References: <87o7e9ei3p.fsf@ushin.org> <87wmsx3vyc.fsf@localhost> <87a5pro14q.fsf@ushin.org> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ushin.org; s=key1; t=1703970909; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=I1txutDVS9GYQ2WAtdSG7BC3bOq5YQ4fD1K+HVASyHc=; b=cG9xp7IsKIRO0u/1qpgKsw2YZkZXoXY4qr9MjIQi13REwZQQLXDQ34Vu5jEiGIYoPGuPXq 2cpt8xqVtBdM0YUHyroZ/WTgd+h/Ci5BQfpoHdc64RhnEuosFICXw78PK7uDTOiyLBoVKw JshwgPiRzmLkgMUJZpMGQgaoKnZPXK3HSbH6qpFIK8O/iwRThgPIGmFDMDsBd/DQWLeNfj f5zlJl06jGjPxhWOPZBHcSiPFuWd7aVhREAxx5G7ANYaTgiHNDgO5RFSSDpkxjwywB6U3I wxM1Txw2TLh4SZwag9ppw6WiKaQWulJz+oo5vvEiaW7PAU/6Rk9ypEJTGjQE+A== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Joseph Turner To: Ihor Radchenko , emacs-orgmode@gnu.org, Adam Porter Subject: Re: Should org-link-parser add type "file" when link has no "file:" prefix? Date: Sat, 30 Dec 2023 13:12:38 -0800 In-reply-to: <87a5pro14q.fsf@ushin.org> Message-ID: <8734vjo0j0.fsf@ushin.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=95.215.58.182; 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: -5.30 X-Spam-Score: -5.30 X-Migadu-Queue-Id: 6AC82579CE X-Migadu-Scanner: mx11.migadu.com X-TUID: uzIwiJfz/SAY --=-=-= Content-Type: text/plain Joseph Turner writes: > - When handling "file" type links, check if `org-current-uri-scheme' > matches one of the keys in `org-link-parameters', and use the > appropriate handler instead of the "file" handler. (see attached patch > for an example usage in `org-link-open') Please ignore the last patch - this one checks for a "file:" prefix. Joseph --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=org-current-uri-scheme-follow-2.patch diff --git a/lisp/ol.el b/lisp/ol.el index 20aab6bb8..947576ddb 100644 --- a/lisp/ol.el +++ b/lisp/ol.el @@ -1097,12 +1097,16 @@ (defun org-link-open (link &optional arg) ;; first need to integrate search option, if any. ("file" (let* ((option (org-element-property :search-option link)) - (path (if option (concat path "::" option) path))) - (org-link-open-as-file path - (pcase (org-element-property :application link) - ((guard arg) arg) - ("emacs" 'emacs) - ("sys" 'system))))) + (path (if option (concat path "::" option) path)) + (f (org-link-get-parameter org-current-uri-scheme :follow))) + (if (and (not (org-element-property :type-explicit-p link)) + (functionp f)) + (funcall f path) + (org-link-open-as-file path + (pcase (org-element-property :application link) + ((guard arg) arg) + ("emacs" 'emacs) + ("sys" 'system)))))) ;; Internal links. ((or "coderef" "custom-id" "fuzzy" "radio") (unless (run-hook-with-args-until-success 'org-open-link-functions path) --=-=-=--