emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Joseph Turner <joseph@ushin.org>
To: Ihor Radchenko <yantar92@posteo.net>,
	emacs-orgmode@gnu.org, Adam Porter <adam@alphapapa.net>
Subject: Re: Should org-link-parser add type "file" when link has no "file:" prefix?
Date: Sat, 30 Dec 2023 13:12:38 -0800	[thread overview]
Message-ID: <8734vjo0j0.fsf@ushin.org> (raw)
In-Reply-To: <87a5pro14q.fsf@ushin.org>

[-- Attachment #1: Type: text/plain, Size: 372 bytes --]

Joseph Turner <joseph@ushin.org> 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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-current-uri-scheme-follow-2.patch --]
[-- Type: text/x-diff, Size: 1127 bytes --]

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)

  reply	other threads:[~2023-12-30 21:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-29  4:12 Should org-link-parser add type "file" when link has no "file:" prefix? Joseph Turner
2023-12-29 14:49 ` Ihor Radchenko
2023-12-29 22:05   ` Joseph Turner
2023-12-30 21:12     ` Joseph Turner [this message]
2023-12-31 15:07     ` Ihor Radchenko
2024-01-01  6:52       ` Joseph Turner
2024-01-02 13:20         ` Ihor Radchenko
2024-01-14  7:10           ` Joseph Turner
2024-01-16 13:40             ` Ihor Radchenko
2024-01-16 20:16               ` Joseph Turner
2024-01-17 13:15                 ` Ihor Radchenko
2024-01-31 22:10                   ` joseph
2024-02-01 12:23                     ` Ihor Radchenko
2024-02-02  4:35                       ` joseph
2024-02-02 16:01                         ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8734vjo0j0.fsf@ushin.org \
    --to=joseph@ushin.org \
    --cc=adam@alphapapa.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).