Ver código fonte

`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.
Nicolas Goaziou 10 anos atrás
pai
commit
e69c4e7a1b
2 arquivos alterados com 14 adições e 6 exclusões
  1. 5 4
      lisp/org.el
  2. 9 2
      testing/lisp/test-org.el

+ 5 - 4
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))

+ 9 - 2
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?"