Hi Bastien, The changes to org-store-link in commit ecb9e5811 cause a couple of issues:
1) When an org-capture template is invoked with (a) an active region and (b) an annotation (i.e., a link), the link is not inserted in the capture buffer. Here is a sample org-capture template: --8<---------------cut here---------------start------------->8--- (setq org-capture-templates '(("n" "Note" entry (file "~/org/inbox.org") "* %^{Title}\n %U\n %a\n\n %i"))) --8<---------------cut here---------------end--------------->8--- When I invoke org capture on a file with the region active (say, using this draft email), I end up with a capture buffer that looks like this: --8<---------------cut here---------------start------------->8--- * Title [2013-03-25 Mon 17:03] When I invoke --8<---------------cut here---------------end--------------->8--- Note the missing link. Prior to commit ecb9e5811, the capture buffer looked like this: --8<---------------cut here---------------start------------->8--- * Title [2013-03-25 Mon 17:03] [[gnus:nnml:sent#8738vjb0hw....@fastmail.fm][Matt Lundin: Capture/store link bug]] When I invoke --8<---------------cut here---------------end--------------->8--- 2) org-store-links contains multiple entries for each link. If I set org-stored-links to nil and then invoke org-stored-link *once* with the region active in a file (say, lines 9305 to 9309 in org.el), I am given the following options when invoking org-insert-link. Note this is only after invoking org-stored-link once: --8<---------------cut here---------------start------------->8--- <no description> <file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region))> <no description> <file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region)) > <no description> <file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region)) (save-excursion > <no description> <file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region)) (save-excursion> <no description> <file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region)) (save-excursion> <no description> <file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region)) (save-excursion> <no description> <file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region)) (save-excursion> --8<---------------cut here---------------end--------------->8--- It seems this is a list of duplicates. The value of org-stored-link is as follows: --8<---------------cut here---------------start------------->8--- Contains the links stored with `org-store-link'. Value: ((#("file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region))\n (save-excursion" 29 30 (fontified t) 30 32 (face font-lock-keyword-face fontified t) 33 37 (fontified t) 38 59 (fontified t) 60 64 (fontified t) 65 80 (fontified t) 82 83 (fontified t) 83 97 (face font-lock-keyword-face fontified t)) nil) (#("file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region))\n (save-excursion" 29 30 (fontified t) 30 32 (face font-lock-keyword-face fontified t) 33 37 (fontified t) 38 59 (fontified t) 60 64 (fontified t) 65 80 (fontified t) 82 83 (fontified t) 83 97 (face font-lock-keyword-face fontified t)) nil) (#("file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region))\n (save-excursion" 29 30 (fontified t) 30 32 (face font-lock-keyword-face fontified t) 33 37 (fontified t) 38 59 (fontified t) 60 64 (fontified t) 65 80 (fontified t) 82 83 (fontified t) 83 97 (face font-lock-keyword-face fontified t)) nil) (#("file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region))\n (save-excursion" 29 30 (fontified t) 30 32 (face font-lock-keyword-face fontified t) 33 37 (fontified t) 38 59 (fontified t) 60 64 (fontified t) 65 80 (fontified t) 82 83 (fontified t) 83 97 (face font-lock-keyword-face fontified t)) nil) (#("file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region))\n (save-excursion\n" 29 30 (fontified t) 30 32 (face font-lock-keyword-face fontified t) 33 37 (fontified t) 38 59 (fontified t) 60 64 (fontified t) 65 81 (fontified t) 82 83 (fontified t) 83 97 (face font-lock-keyword-face fontified t) 97 98 (fontified t)) nil) (#("file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region))\n" 29 30 (fontified t) 30 32 (face font-lock-keyword-face fontified t) 33 37 (fontified t) 38 59 (fontified t) 60 64 (fontified t) 65 81 (fontified t)) nil) (#("file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region))" 29 30 (fontified t) 30 32 (face font-lock-keyword-face fontified t) 33 37 (fontified t) 38 59 (fontified t) 60 64 (fontified t) 65 80 (fontified t)) nil)) --8<---------------cut here---------------end--------------->8--- Best, Matt