Re: [PATCH] ol.el: Recommend `browse-url' to `:follow' links

2023-02-11 Thread Ihor Radchenko
Max Nikulin  writes:

>> Maybe better add this to "A.3 Adding Hyperlink Types" section of the manual?
>
> If you you believe that the (info "(org) Adding Hyperlink Types") 
> section should be expanded then a complete example is necessary, some 
> ideas may be picked from
>
> https://orgmode.org/worg/org-faq.html#mailto-links
> https://orgmode.org/worg/org-faq.html#mid-url-handler
>
> While the manual section and the `org-link-parameters' docstring as the 
> reference may be cross-linked, some note on `browse-url' still may be 
> helpful in the latter.

I believe that examples like yours really belong to the manual, not to
the docstring. Your example is the shortest possible way to define a new
link type as opposed to writing a whole new library - something rather
hard to achieve for less experienced users.

So, I suggest to
1. Put your example to the beginning of "Adding Hyperlink Types" section
   of the manual as the simplest way to define a new link type and
   use ol-man as a more complex example if more features are needed.

2. Refer to (info "(org) Adding Hyperlink Types") from the docstring of
   `org-link-parameters'.

WDYT?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] ol.el: Recommend `browse-url' to `:follow' links

2023-02-10 Thread Max Nikulin

On 10/02/2023 18:13, Ihor Radchenko wrote:

Max Nikulin writes:


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.


Maybe better add this to "A.3 Adding Hyperlink Types" section of the manual?


If you you believe that the (info "(org) Adding Hyperlink Types") 
section should be expanded then a complete example is necessary, some 
ideas may be picked from


https://orgmode.org/worg/org-faq.html#mailto-links
https://orgmode.org/worg/org-faq.html#mid-url-handler

While the manual section and the `org-link-parameters' docstring as the 
reference may be cross-linked, some note on `browse-url' still may be 
helpful in the latter.





Re: [PATCH] ol.el: Recommend `browse-url' to `:follow' links

2023-02-10 Thread Ihor Radchenko
Max Nikulin  writes:

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

Maybe better add this to "A.3 Adding Hyperlink Types" section of the manual?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



[PATCH] ol.el: Recommend `browse-url' to `:follow' links

2023-02-09 Thread Max Nikulin
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 
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  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