Browse Source

org.el (org-store-link): Use keyword at point as the search string

* org.el (org-store-link): Use keyword at point as the search
string.

Thanks to Thomas Dye for reporting this.
Bastien Guerry 13 years ago
parent
commit
416357c82c
1 changed files with 5 additions and 2 deletions
  1. 5 2
      lisp/org.el

+ 5 - 2
lisp/org.el

@@ -9021,10 +9021,13 @@ part of Org's core."
 			       (buffer-file-name (buffer-base-buffer)))))
 			       (buffer-file-name (buffer-base-buffer)))))
 	 ;; Add a context search string
 	 ;; Add a context search string
 	 (when (org-xor org-context-in-file-links arg)
 	 (when (org-xor org-context-in-file-links arg)
-	   (setq txt (cond
+	   (let ((e (org-element-at-point)))
+	     (setq txt (cond
 		      ((org-at-heading-p) nil)
 		      ((org-at-heading-p) nil)
+		      ((eq (org-element-type e) 'keyword)
+		       (plist-get (cadr e) :value))
 		      ((org-region-active-p)
 		      ((org-region-active-p)
-		       (buffer-substring (region-beginning) (region-end)))))
+		       (buffer-substring (region-beginning) (region-end))))))
 	   (when (or (null txt) (string-match "\\S-" txt))
 	   (when (or (null txt) (string-match "\\S-" txt))
 	     (setq cpltxt
 	     (setq cpltxt
 		   (concat cpltxt "::"
 		   (concat cpltxt "::"