瀏覽代碼

Improve following links from the agenda

`C-c C-o' in the agenda will now offer links visible in the agenda
line and also links in the entry text of the original outline node.
Carsten Dominik 15 年之前
父節點
當前提交
c2265b4145
共有 3 個文件被更改,包括 16 次插入7 次删除
  1. 6 0
      doc/org.texi
  2. 1 1
      doc/orgcard.tex
  3. 9 6
      lisp/org-agenda.el

+ 6 - 0
doc/org.texi

@@ -6924,6 +6924,12 @@ numeric prefix argument N, go up to level N and then take that tree.  If N is
 negative, go up that many levels.  With a @kbd{C-u} prefix, do not remove the
 previously used indirect buffer.
 
+@kindex C-c C-o
+@item C-c C-o
+Follow a link in the entry.  This will offer a selection of any links in the
+text belonging to the referenced Org node.  If there is only one link, it
+will be followed without a selection prompt.
+
 @tsubheading{Change display}
 @cindex display changing, in agenda
 @kindex o

+ 1 - 1
doc/orgcard.tex

@@ -667,7 +667,7 @@ after  ``{\tt :}'', and dictionary words elsewhere.
 
 {\bf Misc}
 
-\key{open link in current line}{C-c C-o}
+\key{open link in current line/entry}{C-c C-o}
 
 {\bf Calendar commands}
 

+ 9 - 6
lisp/org-agenda.el

@@ -5496,17 +5496,19 @@ If this information is not given, the function uses the tree at point."
 
 (defun org-agenda-open-link (&optional arg)
   "Follow the link in the current line, if any.
-Also looks in the `after-string' character property, if that is set."
+This looks for a link in the displayed lin in the agenda.  It also looks
+at the text of the entry itself."
   (interactive "P")
-  (let* ((txt (concat (buffer-substring (point-at-bol) (point-at-eol))
+  (let* ((marker (or (get-text-property (point) 'org-hd-marker)
+		     (get-text-property (point) 'org-marker)))
+	 (buffer (and marker (marker-buffer marker)))
+	 (txt (concat (buffer-substring (point-at-bol) (point-at-eol))
 		      "\n"
-		      (get-char-property (point) 'after-string)))
+		      (and marker
+			   (org-agenda-get-some-entry-text marker 100))))
 	 (re (concat "\\(" org-bracket-link-regexp "\\)\\|"
 		     "\\(" org-angle-link-re "\\)\\|"
 		     "\\(" org-plain-link-re "\\)"))
-	 (marker (or (get-text-property (point) 'org-hd-marker)
-		     (get-text-property (point) 'org-marker)))
-	 (buffer (and marker (marker-buffer marker)))
 	 links c link (cnt 0))
     (with-temp-buffer
       (insert txt)
@@ -5520,6 +5522,7 @@ Also looks in the `after-string' character property, if that is set."
       (unless (and (integerp arg) (>= (length links) arg))
 	(save-excursion
 	  (save-window-excursion
+	    (delete-other-windows)
 	    (with-output-to-temp-buffer "*Select Link*"
 	      (princ "Select link\n\n")
 	      (mapc (lambda (l) (princ (format "[%d] %s\n" (incf cnt) l)))