org-store-link: Fix storing of links to headlines in indirect buffers
commit784e5f14888dea7ae98029c38e0f45354f310adf
authorJambunathan K <kjambunathan@gmail.com>
Mon, 23 Aug 2010 04:11:20 +0000 (23 04:11 +0000)
committerCarsten Dominik <carsten.dominik@gmail.com>
Mon, 23 Aug 2010 10:14:20 +0000 (23 12:14 +0200)
treee0503f3213a5ea2bcd0fe8c3772528521c4b49c1
parent9afcc02588e842e5792e65508bb7719355ace352
org-store-link: Fix storing of links to headlines in indirect buffers

* org.el (org-store-link): Storing of links to headlines in indirect
buffers was broken.  Fix it.

TINYCHANGE
Summary:

> When org-store-link is invoked on a headline in indirect buffer (as in a
> capture buffer), hyperlink gets created to the file and NOT the
> headline. This is a bug.
>
> The attached patch fixes this.
>
> Setup:
>
> # ~/.emacs
>
> (defun my-conversation-id ()
>   (interactive)
>
>   (remove-hook 'org-capture-before-finalize-hook 'my-conversation-id)
>
>   (let ((org-link-to-org-use-id t))
>     (call-interactively 'org-store-link)
>     )
>   )
>
> # org-capture-templates
>
>  ("x" "Conversations" entry
>   (file+headline "~/conversation.org" "Conversations")
>   "%(progn (add-hook 'org-capture-before-finalize-hook 'my-conversation-id) \"\")** Note taken on %U\n   %?  " :prepend t :empty-lines 1)
>
> Steps for reproduction:
>
> Trigger org-capture for the above capture entry.
>
> Examine conversation.org before/after the patch is applied. Note the
> absence/presence of IDs for the captured entry.
>
> Check for the stored links using C-c C-l. Note the file/headline links.
>
> # file conversation.org before and after the patch
>
> * Conversations
>
> ** Note taken on [2010-08-23 Mon 04:33]
>    :PROPERTIES:
>    :ID:       7e1974a6-8fa1-43cf-bef3-2adf37d99130
>    :END:
>
> ** Note taken on [2010-08-23 Mon 04:32]
>
> # (org-insert-link) showing stored links before and after the patch
>
> file:~/conversation.org (file:~/conversation.org)
> id:7e1974a6-8fa1-43cf-bef3-2adf37d99130 (Note taken on [2010-08-23 Mon 04:33])
>
lisp/org.el