From: Max Nikulin <manikulin@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] ol.el: Recommend `browse-url' to `:follow' links
Date: Thu, 9 Feb 2023 22:46:03 +0700 [thread overview]
Message-ID: <ts34fs$2ml$1@ciao.gmane.io> (raw)
[-- 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
next reply other threads:[~2023-02-09 15:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-09 15:46 Max Nikulin [this message]
2023-02-10 11:13 ` [PATCH] ol.el: Recommend `browse-url' to `:follow' links Ihor Radchenko
2023-02-10 12:23 ` Max Nikulin
2023-02-11 12: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='ts34fs$2ml$1@ciao.gmane.io' \
--to=manikulin@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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).