summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2015-04-05 14:15:23 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2015-04-05 14:17:58 +0200
commite69c4e7a1b8338ee78a2949648784e805956b9e0 (patch)
tree6ff5945cfffa4c2e22bea83e77d068dd52930bf1
parentc466a4deeebb65988493db5b38f6aa240f8a6eec (diff)
downloadorg-mode-e69c4e7a1b8338ee78a2949648784e805956b9e0.tar.gz
`org-open-at-point' follows links in keywords
* lisp/org.el (org-open-at-point): Follow links in keywords. * testing/lisp/test-org.el (test-org/open-at-point-in-keyword): New test.
-rwxr-xr-xlisp/org.el9
-rw-r--r--testing/lisp/test-org.el11
2 files changed, 14 insertions, 6 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 46fb2ab..e9dc187 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10709,15 +10709,16 @@ 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 keyword link node-property
+ timestamp)
t))
(type (org-element-type context))
(value (org-element-property :value context)))
(cond
((not context) (user-error "No link found"))
- ;; Exception: open timestamps and links in properties drawers
- ;; and comments.
- ((memq type '(comment comment-block node-property))
+ ;; Exception: open timestamps and links in properties
+ ;; drawers, keywords and comments.
+ ((memq type '(comment comment-block keyword node-property))
(cond ((org-in-regexp org-any-link-re)
(org-open-link-from-string (match-string-no-properties 0)))
((or (org-at-timestamp-p t) (org-at-date-range-p t))
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 543a490..3c4d34d 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -1496,15 +1496,22 @@ drops support for Emacs 24.1 and 24.2."
;;;; Open at point
+(ert-deftest test-org/open-at-point-in-keyword ()
+ "Does `org-open-at-point' open link in a keyword line?"
+ (should
+ (org-test-with-temp-text
+ "#+KEYWORD: <point>[[info:emacs#Top]]"
+ (org-open-at-point) t)))
+
(ert-deftest test-org/open-at-point-in-property ()
"Does `org-open-at-point' open link in property drawer?"
(should
(org-test-with-temp-text
- "* Headline
+ "* Headline
:PROPERTIES:
:URL: <point>[[info:emacs#Top]]
:END:"
- (org-open-at-point) t)))
+ (org-open-at-point) t)))
(ert-deftest test-org/open-at-point-in-comment ()
"Does `org-open-at-point' open link in a commented line?"