diff --git a/doc/org.texi b/doc/org.texi index b1ff3d8ef..b042ed948 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -2973,6 +2973,11 @@ search string. If the automatically created link is not working correctly or accurately enough, you can write custom functions to select the search string and to do the search for particular file types---see @ref{Custom searches}. The key binding @kbd{C-c l} is only a suggestion---see @ref{Installation}. + +@b{Agenda view}@* +When the cursor is in an agenda view, the created link points to the +entry referenced by the current line. + @c @kindex C-c C-l @cindex link completion diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 30c24bd6a..fabee582a 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2009-09-12 Carsten Dominik + + * org.el (org-store-link): When in agenda buffer, link to + referenced entry. + + * org-macs.el (org-with-point-at): Add a `lisp-indent-function' + property. + 2009-09-10 Carsten Dominik * org-latex.el (org-export-latex-first-lines): Fix problem with diff --git a/lisp/org-macs.el b/lisp/org-macs.el index 4aa581694..192e1cdd7 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -102,6 +102,7 @@ We use a macro so that the test can happen at compilation time." (save-excursion (goto-char (or ,pom (point))) ,@body))) +(put 'org-with-point-at 'lisp-indent-function 1) (defmacro org-no-warnings (&rest body) (cons (if (fboundp 'with-no-warnings) 'with-no-warnings 'progn) body)) diff --git a/lisp/org.el b/lisp/org.el index 291720f8b..68f5acaec 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -7141,6 +7141,8 @@ type. For a simple example of an export function, see `org-bbdb.el'." (setcdr (assoc type org-link-protocols) (list follow export)) (push (list type follow export) org-link-protocols))) +(defvar org-agenda-buffer-name) + ;;;###autoload (defun org-store-link (arg) "\\Store an org-link to the current location. @@ -7180,6 +7182,14 @@ For file links, arg negates `org-context-in-file-links'." (insert link) (setq link (concat "(" label ")") desc nil))) + ((equal (org-bound-and-true-p org-agenda-buffer-name) (buffer-name)) + ;; We are in the agenda, link to referenced location + (let ((m (or (get-text-property (point) 'org-hd-marker) + (get-text-property (point) 'org-marker)))) + (unless m (error "Don't know what location to link to")) + (org-with-point-at m + (call-interactively 'org-store-link)))) + ((eq major-mode 'calendar-mode) (let ((cd (calendar-cursor-to-date))) (setq link