From ea1d4d061a74d7797bf5cf78dc2722eb0baaf7be Mon Sep 17 00:00:00 2001 From: Konubinix Date: Mon, 26 Jan 2015 08:44:06 +0100 Subject: [PATCH] Find a link after point in `org-open-at-point' * lisp/org.el (org-open-at-point): Look for a link after point but in the same line as (point) when called inside a paragraph. Now, the user doesn't have to move the cursor to the link to call `org-open-at-point'. --- lisp/org.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index 1041c13..5373179 100755 --- a/lisp/org.el +++ b/lisp/org.el @@ -10694,7 +10694,9 @@ link in a property drawer line." (org-element-lineage (org-element-context) '(comment comment-block footnote-definition footnote-reference - headline inlinetask link node-property timestamp) + headline inlinetask link node-property + timestamp paragraph + ) t)) (type (org-element-type context)) (value (org-element-property :value context))) @@ -10870,6 +10872,12 @@ link in a property drawer line." (= (org-element-property :post-affiliated context) (line-beginning-position))))))) (org-footnote-action)) + ;; On a paragraph, find a link on the current line after point. + ((memq type '(paragraph)) + (save-excursion + (if (re-search-forward org-any-link-re (line-end-position) t) + (org-open-at-point) + (user-error "No link found")))) (t (user-error "No link found"))))) (move-marker org-open-link-marker nil) (run-hook-with-args 'org-follow-link-hook))) -- 2.1.4