I think, it might be helpful to mention the `browse-url' package in the
docs for the :follow property of `org-link-parameters'. Writing code to
launch an external application may be tricky, so it is better to
delegate the task to existing utilities.From 9d6b216d4bd654f976cd889dec2f805f05f76428 Mon Sep 17 00:00:00 2001
From: Max Nikulin <maniku...@gmail.com>
Date: Thu, 9 Feb 2023 22:31:51 +0700
Subject: [PATCH] ol.el: Recommend `browse-url' to `:follow' links
* lisp/ol.el (org-link-parameters): Recommend the `browse-url' function
for calling external protocol handlers in the docstring.
This is indirect follow-up of the
https://list.orgmode.org/3218434.44cspzl...@linux.fritz.box/ thread.
---
lisp/ol.el | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/lisp/ol.el b/lisp/ol.el
index 9e4781f6e..dd883ab29 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -109,6 +109,20 @@ (defcustom org-link-parameters nil
Here, you may use `org-link-open-as-file' helper function for
types similar to \"file\".
+ To invoke an external handler of specific URI scheme such as \"irc:\",
+ consider delegating the task to `browse-url', for details
+ see Info node `(emacs) Browse-URL'.
+
+ (lambda (path &optional arg)
+ (browse-url (concat type \":\" path) arg))
+
+ Either ensure that a system-wide protocol handler is configured or
+ add an entry to `browse-url-handlers' for Emacs-28 and newer
+ or define `browse-url-browser-function' as alist for older versions.
+ The advantage of this approach is that the same handler
+ will be available for `goto-address-mode'
+ (see Info node `(emacs) Goto Address mode').
+
`:export'
Function that accepts four arguments:
--
2.25.1