branch: externals/org
commit 4459e5c98e959b62d1851dcb65482d3107d9c157
Author: Ihor Radchenko <[email protected]>
Commit: Ihor Radchenko <[email protected]>
org-open-at-point-global: Support prefix argument
* lisp/org.el (org-open-at-point-global): Add optional argument. Pass
it through to `org-link-open-from-string'.
* etc/ORG-NEWS (~org-open-at-point-global~ now accepts prefix argument):
Document the change.
---
etc/ORG-NEWS | 5 +++++
lisp/org.el | 12 +++++++-----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 6ee0a263fa..f4ff44d299 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -628,6 +628,11 @@ has been made obsolete. Its value is still used in place
of default
parameter -jar if the variable is defined.
** Miscellaneous
+*** ~org-open-at-point-global~ now accepts prefix argument
+
+The argument is passed through to ~org-link-open~, allowing alternative
+way to open links, if link ~:follow~ function supports it.
+
*** Inline tasks in a clocktable will be indented to a level below their
heading
Previously a clocktable that contained an inline task would show the
diff --git a/lisp/org.el b/lisp/org.el
index fabbff0771..c07e21a07d 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -8711,14 +8711,15 @@ If the file does not exist, throw an error."
(funcall save-position-maybe)))
;;;###autoload
-(defun org-open-at-point-global ()
+(defun org-open-at-point-global (&optional arg)
"Follow a link or a timestamp like Org mode does.
+Pass ARG to `org-link-open-to-string'.
Also follow links and emails as seen by `thing-at-point'.
This command can be called in any mode to follow an external
link or a timestamp that has Org mode syntax. Its behavior
is undefined when called on internal links like fuzzy links.
Raise a user error when there is nothing to follow."
- (interactive)
+ (interactive "P")
(let ((tap-url (thing-at-point 'url))
(tap-email (thing-at-point 'email)))
(cond ((org-in-regexp
@@ -8731,13 +8732,14 @@ Raise a user error when there is nothing to follow."
(save-excursion
(forward-paragraph)
(count-lines origin (point))))))
- (org-link-open-from-string (match-string-no-properties 0)))
+ (org-link-open-from-string (match-string-no-properties 0) arg))
((or (org-in-regexp org-ts-regexp-both nil t)
(org-in-regexp org-tsr-regexp-both nil t))
(org-follow-timestamp-link))
- (tap-url (org-link-open-from-string tap-url))
+ (tap-url (org-link-open-from-string tap-url arg))
(tap-email (org-link-open-from-string
- (concat "mailto:" tap-email)))
+ (concat "mailto:" tap-email)
+ arg))
(t (user-error "No link found")))))
(defvar org-open-at-point-functions nil