diff options
author | Jambunathan K <kjambunathan@gmail.com> | 2010-08-23 03:37:31 +0000 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2010-08-23 12:18:00 +0200 |
commit | 5908e8ed7bc87e4fbe77714d84a3087f50a545a8 (patch) | |
tree | 9d5d3fd6d99625e0ffb9f15cd75f64b9b15152ed | |
parent | 784e5f14888dea7ae98029c38e0f45354f310adf (diff) | |
download | org-mode-5908e8ed7bc87e4fbe77714d84a3087f50a545a8.tar.gz |
org-store-link: Return link when invoked from within agenda buffer
* org.el (org-store-link): Return link when invoked non-interactively from
an agenda buffer.
TINYCHANGE
> Summary:
>
> When I trigger a org-capture, with the cursor positioned on a line in
> the agenda buffer, I want the link to the agenda entry to be available
> as an annotation (%a) to the capture process. Currently this is broken.
>
> The enclosed patch fixes this.
>
> Setup:
>
> # file todo.org
> * TODO Talk to someone
> SCHEDULED: <2010-08-23 Mon>
>
> # org-capture-templates
> ("z" "Conversation" entry
> (file+headline "~/conversation.org" "Conversations")
> "** Note taken on %U\n %a\n %?" :prepend t :empty-lines 1)
>
> Steps for reporduction:
>
> 1. Restrict agenda to todo.org
> 2. Do org-agenda
> 3. Place the cursor on the above todo line
> 4. Trigger an org-capture for the above capture entry
>
> Examine the entries in conversation.org before/after the patch is
> applied. Note the absence/presence of the link to the parent todo entry.
>
> * Conversations
>
> ** Note taken on [2010-08-23 Mon 03:58]
> [[file:~/todo.org::*Talk%20to%20someone][Talk to someone]]
>
> ** Note taken on [2010-08-23 Mon 03:42]
>
> Jambunathan K.
-rw-r--r-- | lisp/org.el | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lisp/org.el b/lisp/org.el index be3b8c3..15379ef 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8218,7 +8218,7 @@ For file links, arg negates `org-context-in-file-links'." (org-load-modules-maybe) (setq org-store-link-plist nil) ; reset (let ((outline-regexp (org-get-limited-outline-regexp)) - link cpltxt desc description search txt custom-id) + link cpltxt desc description search txt custom-id agenda-link) (cond ((run-hook-with-args-until-success 'org-store-link-functions) @@ -8250,9 +8250,10 @@ For file links, arg negates `org-context-in-file-links'." (get-text-property (point) 'org-marker)))) (when m (org-with-point-at m - (if (interactive-p) - (call-interactively 'org-store-link) - (org-store-link nil)))))) + (setq agenda-link + (if (interactive-p) + (call-interactively 'org-store-link) + (org-store-link nil))))))) ((eq major-mode 'calendar-mode) (let ((cd (calendar-cursor-to-date))) @@ -8392,7 +8393,7 @@ For file links, arg negates `org-context-in-file-links'." "::#" custom-id)) (setq org-stored-links (cons (list link desc) org-stored-links)))) - (and link (org-make-link-string link desc))))) + (or agenda-link (and link (org-make-link-string link desc)))))) (defun org-store-link-props (&rest plist) "Store link properties, extract names and addresses." |