emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] ol.el: Recommend `browse-url' to `:follow' links
@ 2023-02-09 15:46 Max Nikulin
  2023-02-10 11:13 ` Ihor Radchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Max Nikulin @ 2023-02-09 15:46 UTC (permalink / raw)
  To: emacs-orgmode

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

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.

[-- Attachment #2: 0001-ol.el-Recommend-browse-url-to-follow-links.patch --]
[-- Type: text/x-patch, Size: 1465 bytes --]

From 9d6b216d4bd654f976cd889dec2f805f05f76428 Mon Sep 17 00:00:00 2001
From: Max Nikulin <manikulin@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.44csPzL39Z@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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-02-11 12:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-09 15:46 [PATCH] ol.el: Recommend `browse-url' to `:follow' links Max Nikulin
2023-02-10 11:13 ` Ihor Radchenko
2023-02-10 12:23   ` Max Nikulin
2023-02-11 12:01     ` Ihor Radchenko

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).