Mirko Vukovic writes:
> For most of my links, I want to use the ID generated by orgmode
> i.e., (setq org-id-link-to-org-use-id t)
> But occasionally, for targets that are not part of my agenda files, I want
> to store a link of the type file:path.org::*headline
> I wrote the following function to accomplish that:
> (defun org-store-file+headline ()
> "Store link as file + headline"
> (let ((org-id-link-to-org-use-id nil))
> (org-store-link nil t)))
> This function works (lightly tested).
> But is there a built-in way, such as using prefixes or arguments to
> org-store-link? I browsed the code for it, but that function is several
> hundred lines long, and I gave up.
I think the function is the best option, as the logic of whether to
store ids (based on the value of org-id-link-to-org-use-id) is
hard-coded into org-store-link and can't be changed through arguments.
You could always create a custom function and bind it to 'C-c l' in
(defun my-org-store-org-link (arg)
"Store a link org mode.
When there is a prefix arg, use file+headline format"
(let ((org-id-link-to-org-use-id (not arg)))
(org-store-link nil t)))