Julien Cubizolles <j.cubizol...@free.fr> writes: > Darlan Cavalcante Moreira <darc...@gmail.com> writes: > >> I don't think you can change the behavior of a link type to take into >> account somethink similar to graphicspath, but you can easily define >> custom link types: For instance, put this in your org-file >> #+LINK: fig file:my_figure_path/%s >> >> Then you will be able to You write a link such as >> >> [[fig:some_figure.png]] > > It looks perfect, unfortunately, I can't get it to work: > > #+LINK: fig file:/home/wilk/enseignement/doc_cours/optique/%s > > [[fig:test.jpg]] > [[file:/home/wilk/enseignement/doc_cours/optique/test.jpg]] > > The second one gives a picture, the first one doesn't. I'm running a > fairly recent git pull of org-mode, and this possibility is described in > its info file. >
It works fine here. The relevant function is org-link-expand-abbrev and it depends on the variables org-link-abbrev-alist and org-link-abbrev-alist-local. The latter gets initialized from the former and any #+LINK lines in the buffer are added on to it. In my case, the first one is nil, so the second one is affected only by the #+LINK lines in the org buffer. In the context of the org buffer containing the link line, check that the variable is set: C-h v org-link-abbrev-alist-alist-local RET should say that the variable has the value (("fig" . "file:/home/wilk/enseignement/doc_cours/optique/%s")) If that is the case, then again in the context of the buffer, doing ESC ESC : (org-link-expand-abbrev "fig:test.jpg") RET should return the expanded value "file:/home/wilk/enseignement/doc_cours/optique/test.jpg" Hope this helps to track it down. >> ps: Remember to do "C-c C-c" in the #+LINK line after you insert it. > > I was just about to ask about it, thanks ! > Closing and reopening the file should take care of the initialization as well. -- Nick