mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-12-02 08:22:16 +00:00
`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.
This commit is contained in:
parent
c466a4deee
commit
e69c4e7a1b
@ -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))
|
||||
|
@ -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?"
|
||||
|
Loading…
Reference in New Issue
Block a user